Skip to content

Commit

Permalink
[MIG] sale_order_import_edifact: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
duongtq committed Oct 20, 2023
1 parent 58b5c5f commit 17ce326
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 141 deletions.
53 changes: 19 additions & 34 deletions sale_order_import_edifact/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
Import Business Document EDIFACT/D96A Order
===========================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5cd158dc563903a96f99facfaf42f4dc8bb231b12be898d0191b604023bb5caa
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
Expand All @@ -14,16 +17,16 @@ Import Business Document EDIFACT/D96A Order
: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/sale_order_import_edifact
:target: https://github.com/OCA/edi/tree/16.0/sale_order_import_edifact
: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-sale_order_import_edifact
:target: https://translation.odoo-community.org/projects/edi-16-0/edi-16-0-sale_order_import_edifact
: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
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=16.0
:alt: Try me on Runboat

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

UN/EDIFACT
United Nations rules for Elec­tronic Data Interchange for Administration, Commerce and Transport
Expand All @@ -46,30 +49,6 @@ Configuration
=============


EDI Exchange Type "Advanced Settings"

.. code-block:: yaml
components:
process:
usage: input.process.sale.order
sale_order_import:
price_source: order
confirm_order: false
wiz_ctx:
file_ext: 'edi'
release: 'd96a'
doc_type: 'rfq'
- price_source. Can be 'order' or 'pricelist'
- confirm_order. False by default
- wiz_ctx. Wizard's context
- file_ext. File extensions supported. By default: 'txt,d96a'
- release. EDIFACT format release.
- doc_type. ('rfq', "Request for Quotation") | ('order', "Order"). Default 'order'

This module struggles with EDIFACT format, if you need X12 format you will need something like sale_order_import_x12 module.

Regardless format, a concret document should need a concret specification nammed release. For example Amazon uses "D96A" specification.
Expand Down Expand Up @@ -109,8 +88,8 @@ 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:%20sale_order_import_edifact%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
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:%20sale_order_import_edifact%0Aversion:%2016.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.

Expand All @@ -127,6 +106,12 @@ Contributors

* Rafa Morant <[email protected]> (https://www.albasoft.com)
* Marc Poch <[email protected]>
* Duong (Tran Quoc) <[email protected]>

Other credits
~~~~~~~~~~~~~

The migration of this module from 14.0 to 16.0 was financially supported by Camptocamp

Maintainers
~~~~~~~~~~~
Expand All @@ -149,6 +134,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-rmorant|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions sale_order_import_edifact/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Import Business Document EDIFACT/D96A Order",
"summary": "EDIFACT/D96A Order",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"development_status": "Alpha",
"category": "Sales Management",
"website": "https://github.com/OCA/edi",
Expand All @@ -22,7 +22,7 @@
"partner_identification",
"partner_identification_gln",
"base_edifact",
"edi_sale_order_import",
"sale_order_import",
],
"data": [
"wizard/sale_order_import_view.xml",
Expand Down
8 changes: 5 additions & 3 deletions sale_order_import_edifact/models/business_document_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ def _hook_match_partner(self, partner_dict, chatter_msg, domain, order):
)
raise exceptions.UserError(
_(
"Partner GLN Code: %s not found in order file: '%s' "
"from VAT registration number '%s'."
"Partner GLN Code: %(party)s not found in order file: '%(file)s' "
"from VAT registration number '%(vat)s'.",
party=party_id,
file=ctx.get("order_filename"),
vat=ctx.get("rff_va"),
)
% (party_id, ctx.get("order_filename"), ctx.get("rff_va"))
)

return id_number.partner_id
Expand Down
24 changes: 0 additions & 24 deletions sale_order_import_edifact/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@

EDI Exchange Type "Advanced Settings"

.. code-block:: yaml
components:
process:
usage: input.process.sale.order
sale_order_import:
price_source: order
confirm_order: false
wiz_ctx:
file_ext: 'edi'
release: 'd96a'
doc_type: 'rfq'
- price_source. Can be 'order' or 'pricelist'
- confirm_order. False by default
- wiz_ctx. Wizard's context
- file_ext. File extensions supported. By default: 'txt,d96a'
- release. EDIFACT format release.
- doc_type. ('rfq', "Request for Quotation") | ('order', "Order"). Default 'order'

This module struggles with EDIFACT format, if you need X12 format you will need something like sale_order_import_x12 module.

Regardless format, a concret document should need a concret specification nammed release. For example Amazon uses "D96A" specification.
Expand Down
1 change: 1 addition & 0 deletions sale_order_import_edifact/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* Rafa Morant <[email protected]> (https://www.albasoft.com)
* Marc Poch <[email protected]>
* Duong (Tran Quoc) <[email protected]>
1 change: 1 addition & 0 deletions sale_order_import_edifact/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The migration of this module from 14.0 to 16.0 was financially supported by Camptocamp
42 changes: 14 additions & 28 deletions sale_order_import_edifact/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,10 @@ <h1 class="title">Import Business Document EDIFACT/D96A Order</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5cd158dc563903a96f99facfaf42f4dc8bb231b12be898d0191b604023bb5caa
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/edi/tree/14.0/sale_order_import_edifact"><img alt="OCA/edi" src="https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-sale_order_import_edifact"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/226/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/edi/tree/16.0/sale_order_import_edifact"><img alt="OCA/edi" src="https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/edi-16-0/edi-16-0-sale_order_import_edifact"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/builds?repo=OCA/edi&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<dl class="docutils">
<dt>UN/EDIFACT</dt>
<dd>United Nations rules for Elec­tronic Data Interchange for Administration, Commerce and Transport</dd>
Expand All @@ -393,35 +395,14 @@ <h1 class="title">Import Business Document EDIFACT/D96A Order</h1>
<li><a class="reference internal" href="#credits" id="id8">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id9">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id10">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id11">Maintainers</a></li>
<li><a class="reference internal" href="#other-credits" id="id11">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id12">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id3">Configuration</a></h1>
<p>EDI Exchange Type “Advanced Settings”</p>
<pre class="code yaml literal-block">
<span class="nt">components</span><span class="p">:</span><span class="w">
</span><span class="nt">process</span><span class="p">:</span><span class="w">
</span><span class="nt">usage</span><span class="p">:</span><span class="w"> </span><span class="l-Scalar-Plain">input.process.sale.order</span><span class="w">

</span><span class="nt">sale_order_import</span><span class="p">:</span><span class="w">
</span><span class="nt">price_source</span><span class="p">:</span><span class="w"> </span><span class="l-Scalar-Plain">order</span><span class="w">
</span><span class="nt">confirm_order</span><span class="p">:</span><span class="w"> </span><span class="l-Scalar-Plain">false</span><span class="w">
</span><span class="nt">wiz_ctx</span><span class="p">:</span><span class="w">
</span><span class="nt">file_ext</span><span class="p">:</span><span class="w"> </span><span class="s">'edi'</span><span class="w">
</span><span class="nt">release</span><span class="p">:</span><span class="w"> </span><span class="s">'d96a'</span><span class="w">
</span><span class="nt">doc_type</span><span class="p">:</span><span class="w"> </span><span class="s">'rfq'</span>
</pre>
<ul class="simple">
<li>price_source. Can be ‘order’ or ‘pricelist’</li>
<li>confirm_order. False by default</li>
<li>wiz_ctx. Wizard’s context
- file_ext. File extensions supported. By default: ‘txt,d96a’
- release. EDIFACT format release.
- doc_type. (‘rfq’, “Request for Quotation”) | (‘order’, “Order”). Default ‘order’</li>
</ul>
<p>This module struggles with EDIFACT format, if you need X12 format you will need something like sale_order_import_x12 module.</p>
<p>Regardless format, a concret document should need a concret specification nammed release. For example Amazon uses “D96A” specification.</p>
<p>See &lt;<a class="reference external" href="https://www.stedi.com/edi/edifact">https://www.stedi.com/edi/edifact</a>&gt;</p>
Expand Down Expand Up @@ -458,8 +439,8 @@ <h2><a class="toc-backref" href="#id6">14.0.1.0.0 (2023-06-07)</a></h2>
<h1><a class="toc-backref" href="#id7">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/edi/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/edi/issues/new?body=module:%20sale_order_import_edifact%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/edi/issues/new?body=module:%20sale_order_import_edifact%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -475,18 +456,23 @@ <h2><a class="toc-backref" href="#id10">Contributors</a></h2>
<ul class="simple">
<li>Rafa Morant &lt;<a class="reference external" href="mailto:rmorant&#64;albasoft.com">rmorant&#64;albasoft.com</a>&gt; (<a class="reference external" href="https://www.albasoft.com">https://www.albasoft.com</a>)</li>
<li>Marc Poch &lt;<a class="reference external" href="mailto:mpoch&#64;planetatic.com">mpoch&#64;planetatic.com</a>&gt;</li>
<li>Duong (Tran Quoc) &lt;<a class="reference external" href="mailto:duongtq&#64;trobz.com">duongtq&#64;trobz.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id11">Other credits</a></h2>
<p>The migration of this module from 14.0 to 16.0 was financially supported by Camptocamp</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id11">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id12">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/rmorant"><img alt="rmorant" src="https://github.com/rmorant.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/edi/tree/14.0/sale_order_import_edifact">OCA/edi</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/edi/tree/16.0/sale_order_import_edifact">OCA/edi</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions sale_order_import_edifact/tests/test_edifact_order_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@


class TestEdifactOrderImport(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))

@mute_logger("odoo.addons.sale_order_import.wizard.sale_order_import")
def test_edifact_order_import(self):
tests = get_test_data(self.env)
for filename, expected in tests.items():
edifact_file = expected._get_content()
wiz = self.env["sale.order.import"].create(
{
"import_type": "edifact",
"order_file": base64.b64encode(edifact_file),
"order_filename": filename,
}
Expand Down
Loading

0 comments on commit 17ce326

Please sign in to comment.