Skip to content

Commit

Permalink
[ADD] punchout modules
Browse files Browse the repository at this point in the history
  • Loading branch information
benwillig committed Sep 26, 2023
1 parent 6b52c98 commit cfa07fa
Show file tree
Hide file tree
Showing 60 changed files with 1,825 additions and 0 deletions.
1 change: 1 addition & 0 deletions oca_dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ stock-logistics-workflow
connector
storage
server-auth
web
3 changes: 3 additions & 0 deletions punchout/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import controllers
from . import mixins
from . import models
23 changes: 23 additions & 0 deletions punchout/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Punchout",
"version": "13.0.1.0.0",
"license": "AGPL-3",
"author": "Odoo Community Association (OCA), ACSONE SA/NV",
"website": "https://github.com/OCA/edi",
"depends": [
# odoo addons
"base",
# OCA/web
"web_notify",
],
"data": [
"security/punchout_backend.xml",
"security/punchout_request.xml",
"views/punchout_backend.xml",
"views/punchout_request.xml",
],
"external_dependencies": {"python": ["cryptography", "lxml"]},
}
1 change: 1 addition & 0 deletions punchout/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
34 changes: 34 additions & 0 deletions punchout/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import logging

import werkzeug

from odoo.http import Controller, request, route

_logger = logging.getLogger(__name__)


class PunchoutController(Controller):
@route(
"/punchout/cxml/receive/<int:backend_id>",
type="http",
auth="user",
methods=["POST"],
csrf=False,
)
def receive_punchout_response(self, backend_id, *args, **kwargs):
cxml_string = kwargs.get("cxml-urlencoded")
punchout_request = (
request.env["punchout.request"]
.sudo()
._store_punchout_request(backend_id, cxml_string)
)
if not punchout_request:
_logger.error(
"Unable to link the punchout response to a punchout.request "
"with given XML: \n%s",
cxml_string,
)
return werkzeug.utils.redirect("/web")
Loading

0 comments on commit cfa07fa

Please sign in to comment.