Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions edi_account_invoice_import_ubl_endpoint_example/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
=======================================
EDI Invoice Import UBL Endpoint Example
=======================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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_account_invoice_import_ubl_endpoint_example
: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_account_invoice_import_ubl_endpoint_example
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/226/14.0
:alt: Try me on Runbot

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

Provide default endpoint for importing invoices.

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/edi/issues/new?body=module:%20edi_account_invoice_import_ubl_endpoint_example%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
~~~~~~~

* ForgeFlow

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

* Lois Rilo <[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.

.. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px
:target: https://github.com/LoisRForgeFlow
:alt: LoisRForgeFlow

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-LoisRForgeFlow|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Empty file.
22 changes: 22 additions & 0 deletions edi_account_invoice_import_ubl_endpoint_example/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com)
# @author: Lois Rilo <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "EDI Invoice Import UBL Endpoint Example",
"summary": "Provide a default endpoint to import Invoices in UBL format.",
"version": "16.0.1.0.0",
"development_status": "Alpha",
"license": "AGPL-3",
"website": "https://github.com/OCA/edi",
"author": "ForgeFlow,Odoo Community Association (OCA)",
"maintainers": ["LoisRForgeFlow"],
"depends": [
"edi_account_invoice_import",
"account_invoice_import_ubl",
"edi_account_invoice_import_ubl",
"edi_endpoint_oca",
],
"auto_install": False,
"data": ["data/endpoint.xml"],
}
44 changes: 44 additions & 0 deletions edi_account_invoice_import_ubl_endpoint_example/data/endpoint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">

<!--
NOTE: you must assign a backend to this endpoint in invoice to work.
-->
<record id="endpoint_demo_1" model="edi.endpoint">
<field name="backend_type_id" ref="edi_ubl_oca.edi_backend_type_ubl" />
<field
name="exchange_type_id"
ref="edi_account_invoice_import_ubl.edi_exchange_type_invoice_ubl"
/>
<!-- Enable it when ready to be used -->
<field name="active" eval="0" />
<field name="name">UBL import Invoice</field>
<field name="route">/edi/ubl/input/account_invoice</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 = env["account.invoice.import"].parse_xml_invoice(xml_data)
error = False
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 invoice will be processed shortly",
"data": {
"REF": exchange_record.identifier,
}
}
}
</field>
</record>

</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Lois Rilo <[email protected]>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Provide default endpoint for importing invoices.

This module is more an example on how you can create your own endpoint
to manage such exchanges.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading