Skip to content

Commit 5d0bfac

Browse files
committed
Split edi_sale_oca input to edi_sale_input_oca
1 parent 0c2c550 commit 5d0bfac

24 files changed

+151
-181
lines changed

edi_sale_input_oca/README.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bot please :)

edi_sale_input_oca/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import components
2+
from . import wizard

edi_sale_input_oca/__manifest__.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2022 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "EDI Sales input",
6+
"summary": """
7+
Process incoming sale orders with the EDI framework.
8+
""",
9+
"version": "14.0.1.0.0",
10+
"development_status": "Alpha",
11+
"license": "AGPL-3",
12+
"author": "Camptocamp,Odoo Community Association (OCA)",
13+
"maintainers": ["simahawk"],
14+
"website": "https://github.com/OCA/edi",
15+
"depends": [
16+
"edi_sale_oca",
17+
"edi_record_metadata_oca",
18+
"sale_order_import",
19+
],
20+
"data": [],
21+
"demo": [
22+
"demo/edi_exchange_type.xml",
23+
],
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import process
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo>
3+
4+
<record id="demo_edi_exc_type_order_in" model="edi.exchange.type">
5+
<field name="backend_type_id" ref="edi_sale_oca.demo_edi_backend_type_sale" />
6+
<field name="backend_id" ref="edi_sale_oca.demo_edi_backend" />
7+
<field name="name">Demo Sale Order</field>
8+
<field name="code">demo_SaleOrder_in</field>
9+
<field name="direction">input</field>
10+
<field name="exchange_file_ext">xml</field>
11+
<field name="advanced_settings_edit">
12+
components:
13+
process:
14+
usage: input.process.sale.order
15+
env_ctx:
16+
default_price_source: 'pricelist'
17+
default_import_type: 'xml'
18+
random_key: custom
19+
</field>
20+
</record>
21+
22+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* Simone Orsi <simone.orsi@camptocamp.com>
2+
* Duong (Tran Quoc) <duongtq@trobz.com>
3+
* Thien (Vo Hong) <thienvh@trobz.com>

edi_sale_input_oca/readme/CREDITS.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The migration of this module from 14.0 to 16.0 was financially supported by Camptocamp.
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Inbound
2+
~~~~~~~
3+
Receive sale orders from EDI channels.
4+
5+
Control sale order confirmation
6+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7+
8+
You can decide if the order should be confirmed by exchange type.
9+
10+
On your exchange type, go to advanced settings and add the following::
11+
12+
[...]
13+
components:
14+
process:
15+
usage: input.process.sale.order
16+
env_ctx:
17+
# Values for the wizard
18+
default_confirm_order: true
19+
default_price_source: order
20+
# Custom keys, whatever you need
21+
random_one: true
22+
23+
Note that `env_ctx` will propagate all keys to the whole env so you can use it
24+
for any kind of context related configuration. In the case of the sale order import wizard
25+
here we are just passing defaults as we could do in odoo standard.
26+
27+
TODO: shall we add an exchange type example as demo?

edi_sale_input_oca/tests/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import test_process

edi_sale_input_oca/tests/common.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2022 Camptocamp SA
2+
# @author: Simone Orsi <simahawk@gmail.com>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
from odoo import fields
6+
7+
8+
class OrderMixin(object):
9+
@classmethod
10+
def _create_sale_order(cls, **kw):
11+
"""Create a sale order
12+
13+
:return: sale order
14+
"""
15+
model = cls.env["sale.order"]
16+
vals = dict(commitment_date=fields.Date.today())
17+
vals.update(kw)
18+
so_vals = model.play_onchanges(vals, [])
19+
if "order_line" in so_vals:
20+
so_vals["order_line"] = [(0, 0, x) for x in vals["order_line"]]
21+
return model.create(so_vals)
22+
23+
@classmethod
24+
def _setup_order(cls, **kw):
25+
cls.product_a = cls.env.ref("product.product_product_4")
26+
cls.product_a.barcode = "1" * 14
27+
cls.product_b = cls.env.ref("product.product_product_4b")
28+
cls.product_b.barcode = "2" * 14
29+
cls.product_c = cls.env.ref("product.product_product_4c")
30+
cls.product_c.barcode = "3" * 14
31+
cls.product_d = cls.env.ref("product.product_product_5")
32+
cls.product_d.barcode = "4" * 14
33+
line_defaults = kw.pop("line_defaults", {})
34+
vals = {
35+
"partner_id": cls.env.ref("base.res_partner_10").id,
36+
"commitment_date": "2022-07-29",
37+
}
38+
vals.update(kw)
39+
if "client_order_ref" not in vals:
40+
vals["client_order_ref"] = "ABC123"
41+
vals["order_line"] = [
42+
{"product_id": cls.product_a.id, "product_uom_qty": 300, "edi_id": 1000},
43+
{"product_id": cls.product_b.id, "product_uom_qty": 200, "edi_id": 2000},
44+
{"product_id": cls.product_c.id, "product_uom_qty": 100, "edi_id": 3000},
45+
]
46+
if line_defaults:
47+
for line in vals["order_line"]:
48+
line.update(line_defaults)
49+
sale = cls._create_sale_order(**vals)
50+
sale.action_confirm()
51+
return sale

edi_sale_oca/tests/test_process.py edi_sale_input_oca/tests/test_process.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def setUpClass(cls):
1515
super().setUpClass()
1616
cls._setup_env()
1717
cls.backend = cls._get_backend()
18-
cls.exc_type = cls.env.ref("edi_sale_oca.demo_edi_exc_type_order_in")
18+
cls.exc_type = cls.env.ref("edi_sale_input_oca.demo_edi_exc_type_order_in")
1919
cls.record = cls.backend.create_record(
2020
cls.exc_type.code, {"edi_exchange_state": "input_received"}
2121
)
File renamed without changes.

edi_sale_oca/README.rst

+1-122
Original file line numberDiff line numberDiff line change
@@ -1,122 +1 @@
1-
=========
2-
EDI Sales
3-
=========
4-
5-
..
6-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7-
!! This file is generated by oca-gen-addon-readme !!
8-
!! changes will be overwritten. !!
9-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-
!! source digest: sha256:8cc00af990de28ee9679466fc10bfcfe395035c200137f800be3a5fbf69b987e
11-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12-
13-
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
14-
:target: https://odoo-community.org/page/development-status
15-
:alt: Alpha
16-
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17-
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18-
:alt: License: AGPL-3
19-
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github
20-
:target: https://github.com/OCA/edi/tree/14.0/edi_sale_oca
21-
:alt: OCA/edi
22-
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-edi_sale_oca
24-
:alt: Translate me on Weblate
25-
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=14.0
27-
:alt: Try me on Runboat
28-
29-
|badge1| |badge2| |badge3| |badge4| |badge5|
30-
31-
Inbound
32-
~~~~~~~
33-
Receive sale orders from EDI channels.
34-
35-
Control sale order confirmation
36-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37-
38-
You can decide if the order should be confirmed by exchange type.
39-
40-
On your exchange type, go to advanced settings and add the following::
41-
42-
[...]
43-
components:
44-
process:
45-
usage: input.process.sale.order
46-
env_ctx:
47-
# Values for the wizard
48-
default_confirm_order: true
49-
default_price_source: order
50-
# Custom keys, whatever you need
51-
random_one: true
52-
53-
Note that `env_ctx` will propagate all keys to the whole env so you can use it
54-
for any kind of context related configuration. In the case of the sale order import wizard
55-
here we are just passing defaults as we could do in odoo standard.
56-
57-
TODO: shall we add an exchange type example as demo?
58-
59-
.. IMPORTANT::
60-
This is an alpha version, the data model and design can change at any time without warning.
61-
Only for development or testing purpose, do not use in production.
62-
`More details on development status <https://odoo-community.org/page/development-status>`_
63-
64-
**Table of contents**
65-
66-
.. contents::
67-
:local:
68-
69-
Bug Tracker
70-
===========
71-
72-
Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi/issues>`_.
73-
In case of trouble, please check there if your issue has already been reported.
74-
If you spotted it first, help us to smash it by providing a detailed and welcomed
75-
`feedback <https://github.com/OCA/edi/issues/new?body=module:%20edi_sale_oca%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
76-
77-
Do not contact contributors directly about support or help with technical issues.
78-
79-
Credits
80-
=======
81-
82-
Authors
83-
~~~~~~~
84-
85-
* Camptocamp
86-
87-
Contributors
88-
~~~~~~~~~~~~
89-
90-
* Simone Orsi <simone.orsi@camptocamp.com>
91-
* Duong (Tran Quoc) <duongtq@trobz.com>
92-
* Thien (Vo Hong) <thienvh@trobz.com>
93-
94-
Other credits
95-
~~~~~~~~~~~~~
96-
97-
The migration of this module from 14.0 to 16.0 was financially supported by Camptocamp.
98-
99-
Maintainers
100-
~~~~~~~~~~~
101-
102-
This module is maintained by the OCA.
103-
104-
.. image:: https://odoo-community.org/logo.png
105-
:alt: Odoo Community Association
106-
:target: https://odoo-community.org
107-
108-
OCA, or the Odoo Community Association, is a nonprofit organization whose
109-
mission is to support the collaborative development of Odoo features and
110-
promote its widespread use.
111-
112-
.. |maintainer-simahawk| image:: https://github.com/simahawk.png?size=40px
113-
:target: https://github.com/simahawk
114-
:alt: simahawk
115-
116-
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
117-
118-
|maintainer-simahawk|
119-
120-
This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/14.0/edi_sale_oca>`_ project on GitHub.
121-
122-
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1+
bot please :)

edi_sale_oca/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
from . import components
22
from . import models
3-
from . import wizard

edi_sale_oca/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"depends": [
1616
"edi_oca",
1717
"edi_record_metadata_oca",
18-
"sale_order_import",
18+
"sale",
1919
],
2020
"data": [
2121
"views/res_partner.xml",

edi_sale_oca/components/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
from . import process
+3-17
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<odoo>
3-
<record id="demo_edi_exc_type_order_response_out" model="edi.exchange.type">
4-
<field name="backend_type_id" ref="demo_edi_backend_type_sale" />
5-
<field name="backend_id" ref="demo_edi_backend" />
6-
<field name="name">Demo Sale Order Response</field>
7-
<field name="code">demo_SaleOrderResponse_out</field>
8-
<field name="direction">output</field>
9-
<field name="exchange_filename_pattern">{record_name}-{type.code}-{dt}</field>
10-
<field name="exchange_file_ext">xml</field>
11-
<field name="advanced_settings_edit">
12-
components:
13-
generate:
14-
usage: output.sale.generate.demo.OrderResponse
15-
</field>
16-
</record>
17-
18-
<record id="demo_edi_exc_type_order_in" model="edi.exchange.type">
3+
<!-- TODO: add demo and tests for fake input/output exchanges. -->
4+
<!-- <record id="demo_edi_exc_type_order_in" model="edi.exchange.type">
195
<field name="backend_type_id" ref="demo_edi_backend_type_sale" />
206
<field name="backend_id" ref="demo_edi_backend" />
217
<field name="ack_type_id" ref="demo_edi_exc_type_order_response_out" />
@@ -32,6 +18,6 @@ components:
3218
default_import_type: 'xml'
3319
random_key: custom
3420
</field>
35-
</record>
21+
</record> -->
3622

3723
</odoo>

edi_sale_oca/i18n/edi_sale_oca.pot

-12
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,6 @@ msgstr ""
176176
msgid "Sales Order Line"
177177
msgstr ""
178178

179-
#. module: edi_sale_oca
180-
#: code:addons/edi_sale_oca/components/process.py:0
181-
#, python-format
182-
msgid "Sales order %s created"
183-
msgstr ""
184-
185-
#. module: edi_sale_oca
186-
#: code:addons/edi_sale_oca/components/process.py:0
187-
#, python-format
188-
msgid "Sales order has already been imported before"
189-
msgstr ""
190-
191179
#. module: edi_sale_oca
192180
#: model_terms:ir.ui.view,arch_db:edi_sale_oca.view_sales_order_filter
193181
msgid "Source: EDI"

edi_sale_oca/readme/DESCRIPTION.rst

+5-25
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,7 @@
1-
Inbound
2-
~~~~~~~
3-
Receive sale orders from EDI channels.
1+
Handle sale orders via EDI.
42

5-
Control sale order confirmation
6-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
This is a base module to plug sales processes with the EDI framework.
74

8-
You can decide if the order should be confirmed by exchange type.
9-
10-
On your exchange type, go to advanced settings and add the following::
11-
12-
[...]
13-
components:
14-
process:
15-
usage: input.process.sale.order
16-
env_ctx:
17-
# Values for the wizard
18-
default_confirm_order: true
19-
default_price_source: order
20-
# Custom keys, whatever you need
21-
random_one: true
22-
23-
Note that `env_ctx` will propagate all keys to the whole env so you can use it
24-
for any kind of context related configuration. In the case of the sale order import wizard
25-
here we are just passing defaults as we could do in odoo standard.
26-
27-
TODO: shall we add an exchange type example as demo?
5+
To handle inbound/outbound sale orders,
6+
you need to use `edi_sale_input_oca` or `edi_sale_output_oca` modules,
7+
or create your own modules.

edi_sale_oca/tests/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
from . import test_order
2-
from . import test_process
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../edi_sale_input_oca

setup/edi_sale_input_oca/setup.py

+6
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)