Skip to content

Commit

Permalink
[ADD] edi_sale_ubl_endpoint_oca
Browse files Browse the repository at this point in the history
  • Loading branch information
thienvh332 committed Aug 15, 2024
1 parent e9fe1a7 commit a0111fc
Show file tree
Hide file tree
Showing 9 changed files with 577 additions and 0 deletions.
84 changes: 84 additions & 0 deletions edi_sale_ubl_endpoint_oca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
==================================
EDI Sale order import UBL endpoint
==================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:54bc6d47a91a1eb84fd38e91f6fbf89ed1e0af414f2cd7c91fbe609ec6af0757
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github
:target: https://github.com/OCA/edi/tree/14.0/edi_sale_ubl_endpoint_oca
:alt: OCA/edi
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-edi_sale_ubl_endpoint_oca
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Provide default endpoint for importing sale orders.

This module is more an example on how you can create your own endpoint
to manage such exchanges.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/edi/issues/new?body=module:%20edi_sale_ubl_endpoint_oca%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Camptocamp

Contributors
~~~~~~~~~~~~

* thienvh <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/14.0/edi_sale_ubl_endpoint_oca>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Empty file.
15 changes: 15 additions & 0 deletions edi_sale_ubl_endpoint_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "EDI Sale order import UBL endpoint",
"summary": """
Provide a default endpoint to import SO in UBL format.
""",
"version": "14.0.1.0.0",
"development_status": "Alpha",
"license": "AGPL-3",
"website": "https://github.com/OCA/edi",
"author": "Camptocamp,Odoo Community Association (OCA)",
"depends": ["edi_sale_ubl_oca", "edi_endpoint_oca"],
"data": ["data/endpoint.xml"],
}
38 changes: 38 additions & 0 deletions edi_sale_ubl_endpoint_oca/data/endpoint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!--
NOTE: you must assign a backend and an exchange type to this endpoint in order to work.
-->
<record id="endpoint_demo_1" model="edi.endpoint">
<field name="backend_type_id" ref="edi_ubl_oca.edi_backend_type_ubl" />
<!-- Enable it when ready to be used -->
<field name="active" eval="0" />
<field name="name">UBL import SO</field>
<field name="route">/edi/ubl/input/sale_order</field>
<field name="request_method">POST</field>
<field name="request_content_type">application/xml</field>
<field name="exec_mode">code</field>
<field name="code_snippet">
xml_data = request.httprequest.get_data()
parsed, error = env["sale.order.import"]._parse_xml(xml_data)
if error:
raise werkzeug.exceptions.BadRequest(error)

exchange_record = endpoint.create_exchange_record(
file_content=xml_data,
edi_exchange_state="input_received"
)

result = {
"payload": {
"ok": True,
"message": "Your order will be processed shortly",
"data": {
"REF": exchange_record.identifier,
}
}
}
</field>
</record>

</odoo>
1 change: 1 addition & 0 deletions edi_sale_ubl_endpoint_oca/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* thienvh <[email protected]>
4 changes: 4 additions & 0 deletions edi_sale_ubl_endpoint_oca/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Provide default endpoint for importing sale orders.

This module is more an example on how you can create your own endpoint
to manage such exchanges.
Loading

0 comments on commit a0111fc

Please sign in to comment.