Skip to content

Commit 95f1d06

Browse files
committed
[MIG] edi_account_invoice_import_ubl_endpoint_example: Migration to 16.0
1 parent cfc997e commit 95f1d06

File tree

11 files changed

+609
-0
lines changed

11 files changed

+609
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
=======================================
2+
EDI Invoice Import UBL Endpoint Example
3+
=======================================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Alpha
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github
17+
:target: https://github.com/OCA/edi/tree/14.0/edi_account_invoice_import_ubl_endpoint_example
18+
:alt: OCA/edi
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-edi_account_invoice_import_ubl_endpoint_example
21+
:alt: Translate me on Weblate
22+
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23+
:target: https://runbot.odoo-community.org/runbot/226/14.0
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
28+
Provide default endpoint for importing invoices.
29+
30+
This module is more an example on how you can create your own endpoint
31+
to manage such exchanges.
32+
33+
.. IMPORTANT::
34+
This is an alpha version, the data model and design can change at any time without warning.
35+
Only for development or testing purpose, do not use in production.
36+
`More details on development status <https://odoo-community.org/page/development-status>`_
37+
38+
**Table of contents**
39+
40+
.. contents::
41+
:local:
42+
43+
Bug Tracker
44+
===========
45+
46+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi/issues>`_.
47+
In case of trouble, please check there if your issue has already been reported.
48+
If you spotted it first, help us smashing it by providing a detailed and welcomed
49+
`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**>`_.
50+
51+
Do not contact contributors directly about support or help with technical issues.
52+
53+
Credits
54+
=======
55+
56+
Authors
57+
~~~~~~~
58+
59+
* ForgeFlow
60+
61+
Contributors
62+
~~~~~~~~~~~~
63+
64+
* Lois Rilo <lois.rilo@forgeflow.com>
65+
66+
Maintainers
67+
~~~~~~~~~~~
68+
69+
This module is maintained by the OCA.
70+
71+
.. image:: https://odoo-community.org/logo.png
72+
:alt: Odoo Community Association
73+
:target: https://odoo-community.org
74+
75+
OCA, or the Odoo Community Association, is a nonprofit organization whose
76+
mission is to support the collaborative development of Odoo features and
77+
promote its widespread use.
78+
79+
.. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px
80+
:target: https://github.com/LoisRForgeFlow
81+
:alt: LoisRForgeFlow
82+
83+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
84+
85+
|maintainer-LoisRForgeFlow|
86+
87+
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.
88+
89+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

edi_account_invoice_import_ubl_endpoint_example/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com)
2+
# @author: Lois Rilo <lois.rilo@forgeflow.com>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
{
6+
"name": "EDI Invoice Import UBL Endpoint Example",
7+
"summary": "Provide a default endpoint to import Invoices in UBL format.",
8+
"version": "16.0.1.0.0",
9+
"development_status": "Alpha",
10+
"license": "AGPL-3",
11+
"website": "https://github.com/OCA/edi",
12+
"author": "ForgeFlow,Odoo Community Association (OCA)",
13+
"maintainers": ["LoisRForgeFlow"],
14+
"depends": [
15+
"edi_account_invoice_import",
16+
"account_invoice_import_ubl",
17+
"edi_account_invoice_import_ubl",
18+
"edi_endpoint_oca",
19+
],
20+
"auto_install": False,
21+
"data": ["data/endpoint.xml"],
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo noupdate="1">
3+
4+
<!--
5+
NOTE: you must assign a backend to this endpoint in invoice to work.
6+
-->
7+
<record id="endpoint_demo_1" model="edi.endpoint">
8+
<field name="backend_type_id" ref="edi_ubl_oca.edi_backend_type_ubl" />
9+
<field
10+
name="exchange_type_id"
11+
ref="edi_account_invoice_import_ubl.edi_exchange_type_invoice_ubl"
12+
/>
13+
<!-- Enable it when ready to be used -->
14+
<field name="active" eval="0" />
15+
<field name="name">UBL import Invoice</field>
16+
<field name="route">/edi/ubl/input/account_invoice</field>
17+
<field name="request_method">POST</field>
18+
<field name="request_content_type">application/xml</field>
19+
<field name="exec_mode">code</field>
20+
<field name="code_snippet">
21+
xml_data = request.httprequest.get_data()
22+
parsed = env["account.invoice.import"].parse_xml_invoice(xml_data)
23+
error = False
24+
if error:
25+
raise werkzeug.exceptions.BadRequest(error)
26+
27+
exchange_record = endpoint.create_exchange_record(
28+
file_content=xml_data,
29+
edi_exchange_state="input_received"
30+
)
31+
32+
result = {
33+
"payload": {
34+
"ok": True,
35+
"message": "Your invoice will be processed shortly",
36+
"data": {
37+
"REF": exchange_record.identifier,
38+
}
39+
}
40+
}
41+
</field>
42+
</record>
43+
44+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
#
4+
msgid ""
5+
msgstr ""
6+
"Project-Id-Version: Odoo Server 14.0\n"
7+
"Report-Msgid-Bugs-To: \n"
8+
"Last-Translator: \n"
9+
"Language-Team: \n"
10+
"MIME-Version: 1.0\n"
11+
"Content-Type: text/plain; charset=UTF-8\n"
12+
"Content-Transfer-Encoding: \n"
13+
"Plural-Forms: \n"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Lois Rilo <lois.rilo@forgeflow.com>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Provide default endpoint for importing invoices.
2+
3+
This module is more an example on how you can create your own endpoint
4+
to manage such exchanges.
Loading

0 commit comments

Comments
 (0)