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 25, 2023
1 parent 58b5c5f commit 901edc5
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 183 deletions.
64 changes: 20 additions & 44 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:5593f695246c5fb666e0e01b5f8eb8256fab93e4b11a1dcdf64602ee3be92818
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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,45 +49,12 @@ 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.

See <https://www.stedi.com/edi/edifact>

Known issues / Roadmap
======================

.. Enumerate known caveats and future potential improvements.
It is mostly intended for end-users, and can also help
potential new contributors discovering new features to implement.
* Refactor import by release

Changelog
=========

Expand All @@ -101,16 +71,16 @@ Changelog
14.0.1.0.0 (2023-06-07)
~~~~~~~~~~~~~~~~~~~~~~~

* [14.0][MIG] sale_order_import_edifact & base_edifact.
* [14.0][ADD] sale_order_import_edifact & base_edifact.
(`#779 <https://github.com/OCA/edi/pull/779>`_)

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 +97,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 +125,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
9 changes: 6 additions & 3 deletions sale_order_import_edifact/models/business_document_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class BusinessDocumentImport(models.AbstractModel):
_inherit = "business.document.import"

# TODO: refactor code in partner_identification_import and drop this one
@api.model
def _hook_match_partner(self, partner_dict, chatter_msg, domain, order):
"""
Expand Down Expand Up @@ -40,10 +41,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
2 changes: 1 addition & 1 deletion sale_order_import_edifact/readme/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
14.0.1.0.0 (2023-06-07)
~~~~~~~~~~~~~~~~~~~~~~~

* [14.0][MIG] sale_order_import_edifact & base_edifact.
* [14.0][ADD] sale_order_import_edifact & base_edifact.
(`#779 <https://github.com/OCA/edi/pull/779>`_)
5 changes: 0 additions & 5 deletions sale_order_import_edifact/readme/ROADMAP.rst

This file was deleted.

74 changes: 25 additions & 49 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:5593f695246c5fb666e0e01b5f8eb8256fab93e4b11a1dcdf64602ee3be92818
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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 @@ -384,59 +386,28 @@ <h1 class="title">Import Business Document EDIFACT/D96A Order</h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="id3">Configuration</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id4">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#changelog" id="id5">Changelog</a><ul>
<li><a class="reference internal" href="#id1" id="id6">14.0.1.0.0 (2023-06-07)</a></li>
<li><a class="reference internal" href="#changelog" id="id4">Changelog</a><ul>
<li><a class="reference internal" href="#id1" id="id5">14.0.1.0.0 (2023-06-07)</a></li>
</ul>
</li>
<li><a class="reference internal" href="#bug-tracker" id="id7">Bug Tracker</a></li>
<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="#bug-tracker" id="id6">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id7">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id8">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id9">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="id10">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id11">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>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id4">Known issues / Roadmap</a></h1>
<!-- Enumerate known caveats and future potential improvements.
It is mostly intended for end-users, and can also help
potential new contributors discovering new features to implement. -->
<ul class="simple">
<li>Refactor import by release</li>
</ul>
</div>
<div class="section" id="changelog">
<h1><a class="toc-backref" href="#id5">Changelog</a></h1>
<h1><a class="toc-backref" href="#id4">Changelog</a></h1>
<!-- The change log. The goal of this file is to help readers
understand changes between versions. The primary audience is
end users and integrators. Purely technical changes such as
Expand All @@ -447,36 +418,41 @@ <h1><a class="toc-backref" href="#id5">Changelog</a></h1>
forbidden and will likely break the structure of the README.rst
or other documents where this fragment is included. -->
<div class="section" id="id1">
<h2><a class="toc-backref" href="#id6">14.0.1.0.0 (2023-06-07)</a></h2>
<h2><a class="toc-backref" href="#id5">14.0.1.0.0 (2023-06-07)</a></h2>
<ul class="simple">
<li>[14.0][MIG] sale_order_import_edifact &amp; base_edifact.
<li>[14.0][ADD] sale_order_import_edifact &amp; base_edifact.
(<a class="reference external" href="https://github.com/OCA/edi/pull/779">#779</a>)</li>
</ul>
</div>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id7">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id6">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">
<h1><a class="toc-backref" href="#id8">Credits</a></h1>
<h1><a class="toc-backref" href="#id7">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id9">Authors</a></h2>
<h2><a class="toc-backref" href="#id8">Authors</a></h2>
<ul class="simple">
<li>ALBA Software</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id10">Contributors</a></h2>
<h2><a class="toc-backref" href="#id9">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="#id10">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>
<p>This module is maintained by the OCA.</p>
Expand All @@ -486,7 +462,7 @@ <h2><a class="toc-backref" href="#id11">Maintainers</a></h2>
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 901edc5

Please sign in to comment.