Skip to content

Commit 5e9cbdf

Browse files
committed
Add edi_purchase_ubl_output_oca
1 parent 1ac5d62 commit 5e9cbdf

File tree

11 files changed

+88
-0
lines changed

11 files changed

+88
-0
lines changed
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
wait for the bot
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import components
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2021 Camptocamp SA
2+
# @author: Simone Orsi <simone.orsi@camptocamp.com>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
{
6+
"name": "EDI UBL Purchase",
7+
"summary": """Handle outbound exchanges for purchases.""",
8+
"version": "14.0.1.0.0",
9+
"development_status": "Alpha",
10+
"license": "AGPL-3",
11+
"website": "https://github.com/OCA/edi",
12+
"author": "Camptocamp, Odoo Community Association (OCA)",
13+
"maintainers": ["simahawk"],
14+
"depends": ["edi_purchase_oca", "edi_ubl_oca", "purchase_order_ubl"],
15+
"demo": [
16+
"demo/edi_exchange_type.xml",
17+
],
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import generate
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2021 Camptocamp SA
2+
# @author: Simone Orsi <simone.orsi@camptocamp.com>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
6+
from odoo.addons.component.core import Component
7+
8+
9+
class EDIExchangePOGenerate(Component):
10+
"""Generate purchase orders."""
11+
12+
_name = "edi.output.ubl.purchase.order"
13+
_inherit = "edi.component.output.mixin"
14+
_usage = "output.generate.purchase.order"
15+
16+
def generate(self):
17+
return self._generate_ubl_xml()
18+
19+
# TODO: add tests
20+
def _generate_ubl_xml(self):
21+
order = self.record
22+
doc_type = order.get_ubl_purchase_order_doc_type()
23+
if not doc_type:
24+
raise NotImplementedError("TODO: handle no doc type")
25+
version = order.get_ubl_version()
26+
xml_string = order.generate_ubl_xml_string(doc_type, version=version)
27+
return xml_string
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo>
3+
<record id="demo_edi_exc_type_order_out" model="edi.exchange.type">
4+
<field name="backend_type_id" ref="edi_ubl_oca.edi_backend_type_ubl" />
5+
<field name="name">Demo UBL PO out</field>
6+
<field name="code">demo_UBL_PO_out</field>
7+
<field name="direction">output</field>
8+
<field name="exchange_filename_pattern">{record_name}-{type.code}-{dt}</field>
9+
<field name="exchange_file_ext">xml</field>
10+
<field
11+
name="model_ids"
12+
eval="[(6, 0, [ref('purchase.model_purchase_order')])]"
13+
/>
14+
<field name="advanced_settings_edit">
15+
components:
16+
generate:
17+
usage: output.generate.purchase.order
18+
</field>
19+
</record>
20+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
On your exchange type configured for UBL outbound exchanges use this conf in `advanced_settings_edit`::
2+
3+
components:
4+
generate:
5+
usage: output.generate.purchase.order
6+
7+
That's it.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Simone Orsi <simone.orsi@camptocamp.com>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Handle purchase exchanges with the EDI framework.
2+
3+
This module is mostly a glue module for `purchase_order_ubl` with `edi_oca`.
4+
5+
Allows you to generate and send purchase orders as UBL XML files.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../edi_purchase_ubl_output_oca
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

0 commit comments

Comments
 (0)