From 7a12d780ce2f8089fbfa0320059d7ca0241a0b20 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Tue, 2 Aug 2022 14:56:58 +0200 Subject: [PATCH 01/30] Add edi_sale_oca --- edi_sale_oca/README.rst | 88 +++++++++++++++++ edi_sale_oca/__init__.py | 1 + edi_sale_oca/__manifest__.py | 21 ++++ edi_sale_oca/data/job_function.xml | 7 ++ edi_sale_oca/models/__init__.py | 1 + edi_sale_oca/models/sale_order.py | 34 +++++++ edi_sale_oca/readme/CONTRIBUTORS.rst | 1 + edi_sale_oca/readme/DESCRIPTION.rst | 1 + edi_sale_oca/tests/__init__.py | 1 + edi_sale_oca/tests/test_edi.py | 107 +++++++++++++++++++++ edi_sale_oca/views/edi_exchange_record.xml | 30 ++++++ edi_sale_oca/views/res_partner.xml | 22 +++++ edi_sale_oca/views/sale_order.xml | 35 +++++++ 13 files changed, 349 insertions(+) create mode 100644 edi_sale_oca/README.rst create mode 100644 edi_sale_oca/__init__.py create mode 100644 edi_sale_oca/__manifest__.py create mode 100644 edi_sale_oca/data/job_function.xml create mode 100644 edi_sale_oca/models/__init__.py create mode 100644 edi_sale_oca/models/sale_order.py create mode 100644 edi_sale_oca/readme/CONTRIBUTORS.rst create mode 100644 edi_sale_oca/readme/DESCRIPTION.rst create mode 100644 edi_sale_oca/tests/__init__.py create mode 100644 edi_sale_oca/tests/test_edi.py create mode 100644 edi_sale_oca/views/edi_exchange_record.xml create mode 100644 edi_sale_oca/views/res_partner.xml create mode 100644 edi_sale_oca/views/sale_order.xml diff --git a/edi_sale_oca/README.rst b/edi_sale_oca/README.rst new file mode 100644 index 0000000000..7cffd6134b --- /dev/null +++ b/edi_sale_oca/README.rst @@ -0,0 +1,88 @@ +=========== +Edi Account +=========== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github + :target: https://github.com/OCA/edi/tree/14.0/edi_account_oca + :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-edi_account_oca + :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 + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module intends to create a base to be extended by local edi rules +for accounting. + +In order to add a new integration for an account, you need to create a listener: + +.. code-block:: python + + class MyEventListener(Component): + _name = "sale.order.event.listener.demo" + _inherit = "base.event.listener" + _apply_on = ["sale.order"] + + def on_post_sale_order(self, move): + """Add your code here about creation of record""" + +A skip if decorator can be added in order to make some checks on the state of the move + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp SA + +Contributors +~~~~~~~~~~~~ + +* Enric Tobella + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/edi `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/edi_sale_oca/__init__.py b/edi_sale_oca/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/edi_sale_oca/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/edi_sale_oca/__manifest__.py b/edi_sale_oca/__manifest__.py new file mode 100644 index 0000000000..80411ee1eb --- /dev/null +++ b/edi_sale_oca/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "EDI Sales", + "summary": """ + Configuration and special behaviors for EDI on sales. + """, + "version": "14.0.1.0.0", + "development_status": "Alpha", + "license": "AGPL-3", + "author": "Camptocamp,Odoo Community Association (OCA)", + "maintainers": ["simahawk"], + "website": "https://github.com/OCA/edi", + "depends": ["sale", "edi_oca", "component_event"], + "data": [ + "views/res_partner.xml", + "views/sale_order.xml", + "views/edi_exchange_record.xml", + ], +} diff --git a/edi_sale_oca/data/job_function.xml b/edi_sale_oca/data/job_function.xml new file mode 100644 index 0000000000..94d62e089a --- /dev/null +++ b/edi_sale_oca/data/job_function.xml @@ -0,0 +1,7 @@ + + + + _edi_auto_handle_generate + + + diff --git a/edi_sale_oca/models/__init__.py b/edi_sale_oca/models/__init__.py new file mode 100644 index 0000000000..6aacb75313 --- /dev/null +++ b/edi_sale_oca/models/__init__.py @@ -0,0 +1 @@ +from . import sale_order diff --git a/edi_sale_oca/models/sale_order.py b/edi_sale_oca/models/sale_order.py new file mode 100644 index 0000000000..b5bdb1b4ec --- /dev/null +++ b/edi_sale_oca/models/sale_order.py @@ -0,0 +1,34 @@ +# Copyright 2022 Camptocamp SA +# @author: Simone Orsi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SaleOrder(models.Model): + _name = "sale.order" + _inherit = ["sale.order", "edi.auto.exchange.consumer.mixin", "edi.id.mixin"] + + # TODO: this field should be moved to the consumer mixin + # Each extending module should then override `states` as needed. + disable_edi_auto = fields.Boolean( + help="When marked, EDI automatic processing will be avoided", + readonly=True, + states={"draft": [("readonly", False)]}, + ) + # Receiver may send or not the response on create + # then for each update IF required. + # https://docs.oasis-open.org/ubl/os-UBL-2.3/UBL-2.3.html#S-ORDERING-POST-AWARD + # https://docs.peppol.eu/poacc/upgrade-3/profiles/28-ordering + # /#_response_code_on_header_level + + # TBD: implementing OrdResp for all modifications + # can be complex to manage (also for the 3rd party). + # Hence, we could block further modifications w/ sale exceptions + # and ask the sender to issue a new order request. + # This approach seems suitable only for orders that do not get processed immediately. + + +class SaleOrderLine(models.Model): + _name = "sale.order.line" + _inherit = ["sale.order.line", "edi.auto.exchange.consumer.mixin", "edi.id.mixin"] diff --git a/edi_sale_oca/readme/CONTRIBUTORS.rst b/edi_sale_oca/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..f1c71bce18 --- /dev/null +++ b/edi_sale_oca/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Simone Orsi diff --git a/edi_sale_oca/readme/DESCRIPTION.rst b/edi_sale_oca/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..1333ed77b7 --- /dev/null +++ b/edi_sale_oca/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +TODO diff --git a/edi_sale_oca/tests/__init__.py b/edi_sale_oca/tests/__init__.py new file mode 100644 index 0000000000..25aeb70b83 --- /dev/null +++ b/edi_sale_oca/tests/__init__.py @@ -0,0 +1 @@ +from . import test_edi diff --git a/edi_sale_oca/tests/test_edi.py b/edi_sale_oca/tests/test_edi.py new file mode 100644 index 0000000000..8ea2092524 --- /dev/null +++ b/edi_sale_oca/tests/test_edi.py @@ -0,0 +1,107 @@ +# Copyright 2022 Camptocamp SA +# @author: Simone Orsi +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +import logging + +from odoo import fields +from odoo.tests.common import tagged + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon +from odoo.addons.component.core import Component +from odoo.addons.component.tests.common import SavepointComponentRegistryCase + +_logger = logging.getLogger(__name__) + + +@tagged("-at_install", "post_install") +class EDIBackendTestCase(AccountTestInvoicingCommon, SavepointComponentRegistryCase): + @classmethod + def setUpClass(cls, chart_template_ref=None): + super().setUpClass(chart_template_ref=chart_template_ref) + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + + class SaleOrderEventListenerDemo(Component): + _name = "sale.order.event.listener.demo" + _inherit = "base.event.listener" + + def on_post_sale_order(self, move): + move.name = "new_name" + + def on_paid_sale_order(self, move): + move.name = "paid" + + def on_cancel_sale_order(self, move): + move.name = "cancelled" + + SaleOrderEventListenerDemo._build_component(cls.comp_registry) + cls.comp_registry._cache.clear() + cls.test_move = ( + cls.env["sale.order"] + .with_context(components_registry=cls.comp_registry) + .create( + { + "move_type": "out_invoice", + "partner_id": cls.partner_a.id, + "date": fields.Date.from_string("2016-01-01"), + "invoice_line_ids": [ + ( + 0, + None, + { + "name": "revenue line 1", + "account_id": cls.company_data[ + "default_account_revenue" + ].id, + "quantity": 1.0, + "price_unit": 100.0, + }, + ), + ( + 0, + None, + { + "name": "revenue line 2", + "account_id": cls.company_data[ + "default_account_revenue" + ].id, + "quantity": 1.0, + "price_unit": 100.0, + "tax_ids": [ + (6, 0, cls.company_data["default_tax_sale"].ids) + ], + }, + ), + ], + } + ) + ) + cls.test_move.refresh() + + def test_paid_move(self): + self.test_move.action_post() + self.assertEqual(self.test_move.name, "new_name") + + payment_action = self.test_move.action_register_payment() + payment = ( + self.env[payment_action["res_model"]] + .with_context(**payment_action["context"]) + .create( + { + "payment_method_id": self.env.ref( + "account.account_payment_method_manual_in" + ).id, + "journal_id": self.company_data["default_journal_bank"].id, + } + ) + ) + payment.with_context( + components_registry=self.comp_registry + ).action_create_payments() + self.assertEqual(self.test_move.name, "paid") + + def test_cancel_move(self): + self.test_move.action_post() + self.assertEqual(self.test_move.name, "new_name") + self.test_move.button_cancel() + self.assertEqual(self.test_move.name, "cancelled") diff --git a/edi_sale_oca/views/edi_exchange_record.xml b/edi_sale_oca/views/edi_exchange_record.xml new file mode 100644 index 0000000000..45f6475beb --- /dev/null +++ b/edi_sale_oca/views/edi_exchange_record.xml @@ -0,0 +1,30 @@ + + + + + + Sale Order Exchange Records + ir.actions.act_window + edi.exchange.record + tree,form + [('model', '=', 'sale.order')] + {} + + + + diff --git a/edi_sale_oca/views/res_partner.xml b/edi_sale_oca/views/res_partner.xml new file mode 100644 index 0000000000..c0afc4a76a --- /dev/null +++ b/edi_sale_oca/views/res_partner.xml @@ -0,0 +1,22 @@ + + + + + res.partner.view.form + res.partner + + + + + + + + + + + diff --git a/edi_sale_oca/views/sale_order.xml b/edi_sale_oca/views/sale_order.xml new file mode 100644 index 0000000000..addb9e2726 --- /dev/null +++ b/edi_sale_oca/views/sale_order.xml @@ -0,0 +1,35 @@ + + + + + sale.order.form (in edi_account) + sale.order + + + + + + + + + + + + + + + From 4ee531fef2a318d705ace60e3aee8a99b732b528 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Sun, 14 Aug 2022 09:48:06 +0200 Subject: [PATCH 02/30] edi_sale: take over edi_sale_order_import --- edi_sale_oca/README.rst | 89 +------------ edi_sale_oca/__init__.py | 1 + edi_sale_oca/__manifest__.py | 8 +- edi_sale_oca/components/__init__.py | 1 + edi_sale_oca/components/process.py | 92 +++++++++++++ edi_sale_oca/readme/DESCRIPTION.rst | 22 ++++ .../templates/exchange_chatter_msg.xml | 37 ++++++ edi_sale_oca/tests/__init__.py | 2 +- edi_sale_oca/tests/test_edi.py | 107 ---------------- edi_sale_oca/tests/test_process.py | 121 ++++++++++++++++++ edi_sale_oca/views/sale_order.xml | 1 + 11 files changed, 284 insertions(+), 197 deletions(-) create mode 100644 edi_sale_oca/components/__init__.py create mode 100644 edi_sale_oca/components/process.py create mode 100644 edi_sale_oca/templates/exchange_chatter_msg.xml delete mode 100644 edi_sale_oca/tests/test_edi.py create mode 100644 edi_sale_oca/tests/test_process.py diff --git a/edi_sale_oca/README.rst b/edi_sale_oca/README.rst index 7cffd6134b..09c967b073 100644 --- a/edi_sale_oca/README.rst +++ b/edi_sale_oca/README.rst @@ -1,88 +1 @@ -=========== -Edi Account -=========== - -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! This file is generated by oca-gen-addon-readme !! - !! changes will be overwritten. !! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png - :target: https://odoo-community.org/page/development-status - :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png - :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html - :alt: License: LGPL-3 -.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github - :target: https://github.com/OCA/edi/tree/14.0/edi_account_oca - :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-edi_account_oca - :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 - -|badge1| |badge2| |badge3| |badge4| |badge5| - -This module intends to create a base to be extended by local edi rules -for accounting. - -In order to add a new integration for an account, you need to create a listener: - -.. code-block:: python - - class MyEventListener(Component): - _name = "sale.order.event.listener.demo" - _inherit = "base.event.listener" - _apply_on = ["sale.order"] - - def on_post_sale_order(self, move): - """Add your code here about creation of record""" - -A skip if decorator can be added in order to make some checks on the state of the move - -**Table of contents** - -.. contents:: - :local: - -Bug Tracker -=========== - -Bugs are tracked on `GitHub 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 `_. - -Do not contact contributors directly about support or help with technical issues. - -Credits -======= - -Authors -~~~~~~~ - -* Camptocamp SA - -Contributors -~~~~~~~~~~~~ - -* Enric Tobella - -Maintainers -~~~~~~~~~~~ - -This module is maintained by the OCA. - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -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. - -This module is part of the `OCA/edi `_ project on GitHub. - -You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. +bot yet to come \ No newline at end of file diff --git a/edi_sale_oca/__init__.py b/edi_sale_oca/__init__.py index 0650744f6b..f24d3e2426 100644 --- a/edi_sale_oca/__init__.py +++ b/edi_sale_oca/__init__.py @@ -1 +1,2 @@ +from . import components from . import models diff --git a/edi_sale_oca/__manifest__.py b/edi_sale_oca/__manifest__.py index 80411ee1eb..df245036b7 100644 --- a/edi_sale_oca/__manifest__.py +++ b/edi_sale_oca/__manifest__.py @@ -12,10 +12,16 @@ "author": "Camptocamp,Odoo Community Association (OCA)", "maintainers": ["simahawk"], "website": "https://github.com/OCA/edi", - "depends": ["sale", "edi_oca", "component_event"], + "depends": [ + "edi_oca", + "edi_exchange_type_auto", + "sale_order_import", + ], "data": [ + "data/job_function.xml", "views/res_partner.xml", "views/sale_order.xml", "views/edi_exchange_record.xml", + "templates/exchange_chatter_msg.xml", ], } diff --git a/edi_sale_oca/components/__init__.py b/edi_sale_oca/components/__init__.py new file mode 100644 index 0000000000..bfb4ceb848 --- /dev/null +++ b/edi_sale_oca/components/__init__.py @@ -0,0 +1 @@ +from . import process diff --git a/edi_sale_oca/components/process.py b/edi_sale_oca/components/process.py new file mode 100644 index 0000000000..33f38ea479 --- /dev/null +++ b/edi_sale_oca/components/process.py @@ -0,0 +1,92 @@ +# Copyright 2021 Camptocamp SA +# @author: Simone Orsi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import _, api +from odoo.exceptions import UserError + +from odoo.addons.component.core import Component + + +class EDIExchangeSOInput(Component): + """Process sale orders.""" + + _name = "edi.input.sale.order.process" + _inherit = "edi.component.input.mixin" + _usage = "input.process.sale.order" + + def __init__(self, work_context): + super().__init__(work_context) + self.settings = {} + # Suppor legacy key `self.type_settings` + for key in ("sale_order", "sale_order_import"): + if key in self.type_settings: + self.settings = self.type_settings.get(key, {}) + break + + def process(self): + wiz = self._setup_wizard() + res = wiz.import_order_button() + # TODO: log debug + if wiz.state == "update" and wiz.sale_id: + order = wiz.sale_id + msg = self.msg_order_existing_error + self._handle_existing_order(order, msg) + raise UserError(msg) + else: + order_id = res["res_id"] + order = self.env["sale.order"].browse(order_id) + if self._order_should_be_confirmed(): + order.action_confirm() + self.exchange_record.sudo()._set_related_record(order) + order._edi_set_origin(self.exchange_record) + return self.msg_order_created % order.name + raise UserError(self.msg_generic_error) + + @property + def msg_order_existing_error(self): + return _("Sales order has already been imported before") + + @property + def msg_order_created(self): + return _("Sales order %s created") + + @property + def msg_generic_error(self): + return _("Something went wrong with the importing wizard.") + + def _setup_wizard(self): + """Init a `sale.order.import` instance for current record.""" + ctx = self.settings.get("wiz_ctx", {}) + wiz = self.env["sale.order.import"].with_context(**ctx).sudo().create({}) + wiz.order_file = self.exchange_record._get_file_content(binary=False) + wiz.order_filename = self.exchange_record.exchange_filename + wiz.order_file_change() + wiz.price_source = self._get_default_price_source() + return wiz + + @api.model + def _get_default_price_source(self): + return self.settings.get("price_source", "pricelist") + + def _order_should_be_confirmed(self): + return self.settings.get("confirm_order", False) + + def _handle_existing_order(self, order, message): + prev_record = self._get_previous_record(order) + self.exchange_record.message_post_with_view( + "edi_sale_order_import.message_already_imported", + values={ + "order": order, + "prev_record": prev_record, + "message": message, + "level": "info", + }, + subtype_id=self.env.ref("mail.mt_note").id, + ) + + def _get_previous_record(self, order): + return self.env["edi.exchange.record"].search( + [("model", "=", "sale.order"), ("res_id", "=", order.id)], limit=1 + ) diff --git a/edi_sale_oca/readme/DESCRIPTION.rst b/edi_sale_oca/readme/DESCRIPTION.rst index 1333ed77b7..c66a89709d 100644 --- a/edi_sale_oca/readme/DESCRIPTION.rst +++ b/edi_sale_oca/readme/DESCRIPTION.rst @@ -1 +1,23 @@ TODO + +Inbound +~~~~~~~ +Receive sale orders from EDI channels. + +Control sale order confirmation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can decide if the order should be confirmed by exchange type. + +On your exchange type, go to advanced settings and add the following:: + + [...] + components: + process: + usage: input.process.sale.order + [...] + sale_order: + confirm_order: true + + +TODO: shall we add an exchange type example as demo? diff --git a/edi_sale_oca/templates/exchange_chatter_msg.xml b/edi_sale_oca/templates/exchange_chatter_msg.xml new file mode 100644 index 0000000000..b57444cc5a --- /dev/null +++ b/edi_sale_oca/templates/exchange_chatter_msg.xml @@ -0,0 +1,37 @@ + + + + diff --git a/edi_sale_oca/tests/__init__.py b/edi_sale_oca/tests/__init__.py index 25aeb70b83..c2bb451dd1 100644 --- a/edi_sale_oca/tests/__init__.py +++ b/edi_sale_oca/tests/__init__.py @@ -1 +1 @@ -from . import test_edi +from . import test_process diff --git a/edi_sale_oca/tests/test_edi.py b/edi_sale_oca/tests/test_edi.py deleted file mode 100644 index 8ea2092524..0000000000 --- a/edi_sale_oca/tests/test_edi.py +++ /dev/null @@ -1,107 +0,0 @@ -# Copyright 2022 Camptocamp SA -# @author: Simone Orsi -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -import logging - -from odoo import fields -from odoo.tests.common import tagged - -from odoo.addons.account.tests.common import AccountTestInvoicingCommon -from odoo.addons.component.core import Component -from odoo.addons.component.tests.common import SavepointComponentRegistryCase - -_logger = logging.getLogger(__name__) - - -@tagged("-at_install", "post_install") -class EDIBackendTestCase(AccountTestInvoicingCommon, SavepointComponentRegistryCase): - @classmethod - def setUpClass(cls, chart_template_ref=None): - super().setUpClass(chart_template_ref=chart_template_ref) - cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) - - class SaleOrderEventListenerDemo(Component): - _name = "sale.order.event.listener.demo" - _inherit = "base.event.listener" - - def on_post_sale_order(self, move): - move.name = "new_name" - - def on_paid_sale_order(self, move): - move.name = "paid" - - def on_cancel_sale_order(self, move): - move.name = "cancelled" - - SaleOrderEventListenerDemo._build_component(cls.comp_registry) - cls.comp_registry._cache.clear() - cls.test_move = ( - cls.env["sale.order"] - .with_context(components_registry=cls.comp_registry) - .create( - { - "move_type": "out_invoice", - "partner_id": cls.partner_a.id, - "date": fields.Date.from_string("2016-01-01"), - "invoice_line_ids": [ - ( - 0, - None, - { - "name": "revenue line 1", - "account_id": cls.company_data[ - "default_account_revenue" - ].id, - "quantity": 1.0, - "price_unit": 100.0, - }, - ), - ( - 0, - None, - { - "name": "revenue line 2", - "account_id": cls.company_data[ - "default_account_revenue" - ].id, - "quantity": 1.0, - "price_unit": 100.0, - "tax_ids": [ - (6, 0, cls.company_data["default_tax_sale"].ids) - ], - }, - ), - ], - } - ) - ) - cls.test_move.refresh() - - def test_paid_move(self): - self.test_move.action_post() - self.assertEqual(self.test_move.name, "new_name") - - payment_action = self.test_move.action_register_payment() - payment = ( - self.env[payment_action["res_model"]] - .with_context(**payment_action["context"]) - .create( - { - "payment_method_id": self.env.ref( - "account.account_payment_method_manual_in" - ).id, - "journal_id": self.company_data["default_journal_bank"].id, - } - ) - ) - payment.with_context( - components_registry=self.comp_registry - ).action_create_payments() - self.assertEqual(self.test_move.name, "paid") - - def test_cancel_move(self): - self.test_move.action_post() - self.assertEqual(self.test_move.name, "new_name") - self.test_move.button_cancel() - self.assertEqual(self.test_move.name, "cancelled") diff --git a/edi_sale_oca/tests/test_process.py b/edi_sale_oca/tests/test_process.py new file mode 100644 index 0000000000..d9e3f8958e --- /dev/null +++ b/edi_sale_oca/tests/test_process.py @@ -0,0 +1,121 @@ +# Copyright 2022 Camptocamp SA +# @author: Simone Orsi +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +import base64 +import textwrap + +import mock + +from odoo import exceptions + +from odoo.addons.component.tests.common import SavepointComponentCase +from odoo.addons.edi_oca.tests.common import EDIBackendTestMixin + + +class TestProcessComponent(SavepointComponentCase, EDIBackendTestMixin): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.backend = cls._get_backend() + cls.exc_type = cls._create_exchange_type( + name="Test SO import", + code="test_so_import", + direction="input", + exchange_file_ext="xml", + exchange_filename_pattern="{record.identifier}-{type.code}-{dt}", + backend_id=cls.backend.id, + advanced_settings_edit=textwrap.dedent( + """ + components: + process: + usage: input.process.sale.order + sale_order_import: + wiz_ctx: + random_key: custom + """ + ), + ) + cls.record = cls.backend.create_record("test_so_import", {}) + cls.record._set_file_content(b"") + cls.wiz_model = cls.env["sale.order.import"] + + def test_lookup(self): + comp = self.backend._get_component(self.record, "process") + self.assertEqual(comp._name, "edi.input.sale.order.process") + + def test_wizard_setup(self): + comp = self.backend._get_component(self.record, "process") + with mock.patch.object( + type(self.wiz_model), "order_file_change" + ) as md_onchange: + wiz = comp._setup_wizard() + self.assertEqual(wiz._name, self.wiz_model._name) + self.assertEqual(wiz.env.context["random_key"], "custom") + self.assertEqual( + base64.b64decode(wiz.order_file), b"" + ) + self.assertEqual(wiz.order_filename, self.record.exchange_filename) + self.assertEqual(wiz.price_source, "pricelist") + md_onchange.assert_called() + + def test_settings(self): + self.exc_type.advanced_settings_edit = textwrap.dedent( + """ + components: + process: + usage: input.process.sale.order + sale_order_import: + price_source: order + confirm_order: true + """ + ) + comp = self.backend._get_component(self.record, "process") + self.assertEqual(comp._get_default_price_source(), "order") + self.assertTrue(comp._order_should_be_confirmed()) + + def test_existing_order(self): + order = self.env["sale.order"].create( + {"partner_id": self.env["res.partner"].search([], limit=1).id} + ) + comp = self.backend._get_component(self.record, "process") + m1 = mock.patch.object(type(self.wiz_model), "order_file_change") + m2 = mock.patch.object(type(self.wiz_model), "import_order_button") + m3 = mock.patch.object( + type(self.wiz_model), + "sale_id", + new_callable=mock.PropertyMock, + ) + m4 = mock.patch.object( + type(self.wiz_model), + "state", + new_callable=mock.PropertyMock, + ) + # Simulate the wizard detected an existing order state + err_msg = "Sales order has already been imported before" + with m1 as md_onchange, m2 as md_btn, m3 as md_sale_id, m4 as md_state: + md_sale_id.return_value = order + md_state.return_value = "update" + with self.assertRaisesRegex(exceptions.UserError, err_msg): + comp.process() + md_onchange.assert_called() + md_btn.assert_called() + self.assertEqual(self.exc_record_in.exchange_error, err_msg) + + def test_new_order(self): + order = self.env["sale.order"].create( + {"partner_id": self.env["res.partner"].search([], limit=1).id} + ) + comp = self.backend._get_component(self.record, "process") + mock1 = mock.patch.object(type(self.wiz_model), "order_file_change") + mock2 = mock.patch.object(type(self.wiz_model), "import_order_button") + self.assertFalse(self.record.record) + # Simulate the wizard detected an existing order state + with mock1 as md_onchange, mock2 as md_btn: + md_btn.return_value = {"res_id": order.id} + res = comp.process() + md_onchange.assert_called() + md_btn.assert_called() + self.assertEqual(res, f"Sales order {order.name} created") + + self.assertEqual(self.record.record, order) diff --git a/edi_sale_oca/views/sale_order.xml b/edi_sale_oca/views/sale_order.xml index addb9e2726..cebb3125e7 100644 --- a/edi_sale_oca/views/sale_order.xml +++ b/edi_sale_oca/views/sale_order.xml @@ -11,6 +11,7 @@ + From d86e9a2cb6579089424b014929e3459dffe19175 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Fri, 2 Sep 2022 14:45:50 +0200 Subject: [PATCH 03/30] edi_sale: filter/group by origin --- edi_sale_oca/views/sale_order.xml | 48 +++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/edi_sale_oca/views/sale_order.xml b/edi_sale_oca/views/sale_order.xml index cebb3125e7..f4d584ad86 100644 --- a/edi_sale_oca/views/sale_order.xml +++ b/edi_sale_oca/views/sale_order.xml @@ -2,8 +2,8 @@ - - sale.order.form (in edi_account) + + sale.order.form (in edi_sale) sale.order @@ -12,6 +12,7 @@ + @@ -33,4 +34,47 @@ + + + sale.order.tree (in edi_sale) + sale.order + + + + + + + + + + + sale.order.search (in edi_sale) + sale.order + + + + + + + + + + + + + + + From e55c2f821f7fa0f9e499192b19d564c71369beb1 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Wed, 14 Sep 2022 17:22:03 +0200 Subject: [PATCH 04/30] edi_sale: handle ext ref for sol --- edi_sale_oca/README.rst | 2 +- edi_sale_oca/__init__.py | 1 + edi_sale_oca/models/sale_order.py | 2 +- edi_sale_oca/wizard/__init__.py | 1 + edi_sale_oca/wizard/sale_order_import.py | 22 ++++++++++++++++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 edi_sale_oca/wizard/__init__.py create mode 100644 edi_sale_oca/wizard/sale_order_import.py diff --git a/edi_sale_oca/README.rst b/edi_sale_oca/README.rst index 09c967b073..40734932d4 100644 --- a/edi_sale_oca/README.rst +++ b/edi_sale_oca/README.rst @@ -1 +1 @@ -bot yet to come \ No newline at end of file +bot yet to come diff --git a/edi_sale_oca/__init__.py b/edi_sale_oca/__init__.py index f24d3e2426..d2243add24 100644 --- a/edi_sale_oca/__init__.py +++ b/edi_sale_oca/__init__.py @@ -1,2 +1,3 @@ from . import components from . import models +from . import wizard diff --git a/edi_sale_oca/models/sale_order.py b/edi_sale_oca/models/sale_order.py index b5bdb1b4ec..005a09cf8a 100644 --- a/edi_sale_oca/models/sale_order.py +++ b/edi_sale_oca/models/sale_order.py @@ -7,7 +7,7 @@ class SaleOrder(models.Model): _name = "sale.order" - _inherit = ["sale.order", "edi.auto.exchange.consumer.mixin", "edi.id.mixin"] + _inherit = ["sale.order", "edi.auto.exchange.consumer.mixin"] # TODO: this field should be moved to the consumer mixin # Each extending module should then override `states` as needed. diff --git a/edi_sale_oca/wizard/__init__.py b/edi_sale_oca/wizard/__init__.py new file mode 100644 index 0000000000..e0ddf6156f --- /dev/null +++ b/edi_sale_oca/wizard/__init__.py @@ -0,0 +1 @@ +from . import sale_order_import diff --git a/edi_sale_oca/wizard/sale_order_import.py b/edi_sale_oca/wizard/sale_order_import.py new file mode 100644 index 0000000000..cdb25a5967 --- /dev/null +++ b/edi_sale_oca/wizard/sale_order_import.py @@ -0,0 +1,22 @@ +# Copyright 2022 Camptocamp SA +# @author: Simone Orsi +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from odoo import api, models + + +class SaleOrderImport(models.TransientModel): + _inherit = "sale.order.import" + + @api.model + def _prepare_create_order_line( + self, product, uom, order, import_line, price_source + ): + vals = super()._prepare_create_order_line( + product, uom, order, import_line, price_source + ) + # TODO: we should probably add an ext reference field to s.o.l. in sale_order_import + # and get rid of this override. + vals["edi_id"] = import_line.get("order_line_ref") + return vals From 71118312d0d7b931455ac71d6029421b4f55bb5d Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Mon, 15 May 2023 16:10:39 +0200 Subject: [PATCH 05/30] edi_sale: show edi_id --- edi_sale_oca/views/sale_order.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/edi_sale_oca/views/sale_order.xml b/edi_sale_oca/views/sale_order.xml index f4d584ad86..61635df466 100644 --- a/edi_sale_oca/views/sale_order.xml +++ b/edi_sale_oca/views/sale_order.xml @@ -32,6 +32,18 @@ + + + + + + From 8053611276f409b0542175e0218b14214177d852 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Thu, 18 May 2023 12:58:06 +0200 Subject: [PATCH 06/30] edi_sale: store metadata --- edi_sale_oca/__manifest__.py | 1 + edi_sale_oca/models/sale_order.py | 13 ++++++ edi_sale_oca/tests/test_process.py | 65 ++++++++++++++++++++++++------ 3 files changed, 67 insertions(+), 12 deletions(-) diff --git a/edi_sale_oca/__manifest__.py b/edi_sale_oca/__manifest__.py index df245036b7..40618b6007 100644 --- a/edi_sale_oca/__manifest__.py +++ b/edi_sale_oca/__manifest__.py @@ -15,6 +15,7 @@ "depends": [ "edi_oca", "edi_exchange_type_auto", + "edi_record_metadata_oca", "sale_order_import", ], "data": [ diff --git a/edi_sale_oca/models/sale_order.py b/edi_sale_oca/models/sale_order.py index 005a09cf8a..fa431cab1a 100644 --- a/edi_sale_oca/models/sale_order.py +++ b/edi_sale_oca/models/sale_order.py @@ -28,6 +28,19 @@ class SaleOrder(models.Model): # and ask the sender to issue a new order request. # This approach seems suitable only for orders that do not get processed immediately. + # edi_record_metadata api + def _edi_get_metadata_to_store(self, orig_vals): + data = super()._edi_get_metadata_to_store(orig_vals) + # collect line values + line_vals_by_edi_id = {} + for line_vals in orig_vals.get("order_line", []): + # line_vals in the form `(0, 0, vals)` + vals = line_vals[-1] + line_vals_by_edi_id[vals["edi_id"]] = vals + + data.update({"orig_values": {"lines": line_vals_by_edi_id}}) + return data + class SaleOrderLine(models.Model): _name = "sale.order.line" diff --git a/edi_sale_oca/tests/test_process.py b/edi_sale_oca/tests/test_process.py index d9e3f8958e..629a0dc672 100644 --- a/edi_sale_oca/tests/test_process.py +++ b/edi_sale_oca/tests/test_process.py @@ -7,8 +7,6 @@ import mock -from odoo import exceptions - from odoo.addons.component.tests.common import SavepointComponentCase from odoo.addons.edi_oca.tests.common import EDIBackendTestMixin @@ -17,6 +15,7 @@ class TestProcessComponent(SavepointComponentCase, EDIBackendTestMixin): @classmethod def setUpClass(cls): super().setUpClass() + cls._setup_env() cls.backend = cls._get_backend() cls.exc_type = cls._create_exchange_type( name="Test SO import", @@ -36,7 +35,9 @@ def setUpClass(cls): """ ), ) - cls.record = cls.backend.create_record("test_so_import", {}) + cls.record = cls.backend.create_record( + "test_so_import", {"edi_exchange_state": "input_received"} + ) cls.record._set_file_content(b"") cls.wiz_model = cls.env["sale.order.import"] @@ -74,11 +75,12 @@ def test_settings(self): self.assertEqual(comp._get_default_price_source(), "order") self.assertTrue(comp._order_should_be_confirmed()) + # In both tests here we don"t care about the specific format of the import. + # We only care that the wizard plugged with the component works as expected. def test_existing_order(self): order = self.env["sale.order"].create( {"partner_id": self.env["res.partner"].search([], limit=1).id} ) - comp = self.backend._get_component(self.record, "process") m1 = mock.patch.object(type(self.wiz_model), "order_file_change") m2 = mock.patch.object(type(self.wiz_model), "import_order_button") m3 = mock.patch.object( @@ -96,26 +98,65 @@ def test_existing_order(self): with m1 as md_onchange, m2 as md_btn, m3 as md_sale_id, m4 as md_state: md_sale_id.return_value = order md_state.return_value = "update" - with self.assertRaisesRegex(exceptions.UserError, err_msg): - comp.process() - md_onchange.assert_called() - md_btn.assert_called() - self.assertEqual(self.exc_record_in.exchange_error, err_msg) + self.record.action_exchange_process() + md_onchange.assert_called() + md_btn.assert_called() + self.assertEqual(self.record.exchange_error, err_msg) def test_new_order(self): + # Create the order manully and use it via the mock on md_btn order = self.env["sale.order"].create( {"partner_id": self.env["res.partner"].search([], limit=1).id} ) - comp = self.backend._get_component(self.record, "process") mock1 = mock.patch.object(type(self.wiz_model), "order_file_change") mock2 = mock.patch.object(type(self.wiz_model), "import_order_button") self.assertFalse(self.record.record) # Simulate the wizard detected an existing order state with mock1 as md_onchange, mock2 as md_btn: md_btn.return_value = {"res_id": order.id} - res = comp.process() + self.record.action_exchange_process() md_onchange.assert_called() md_btn.assert_called() - self.assertEqual(res, f"Sales order {order.name} created") + self.assertEqual(self.record.edi_exchange_state, "input_processed") self.assertEqual(self.record.record, order) + self.assertIn( + "Exchange processed successfully", + "|".join(order.message_ids.mapped("body")), + ) + + def test_metadata(self): + parsed_order = { + "partner": {"email": "john.doe@example.com"}, + "date": "2023-05-18", + "order_ref": "EDISALE", + "lines": [ + { + "product": {"code": "FURN_8888"}, + "qty": 1, + "uom": {"unece_code": "C62"}, + "price_unit": 100, + "order_line_ref": "1111", + } + ], + "chatter_msg": [], + "doc_type": "rfq", + } + self.wiz_model.with_context( + edi_framework_action="process", + sale_order_import__default_vals=dict( + origin_exchange_record_id=self.record.id + ), + ).create_order(parsed_order, "pricelist") + metadata = self.record.get_metadata() + # Lines are mapped via `edi_id` (coming from `order_line_ref` by default) + line_metadata = metadata["orig_values"]["lines"]["1111"] + for k in ( + "product_id", + "product_uom_qty", + "product_uom", + "name", + "price_unit", + "edi_id", + ): + self.assertIn(k, line_metadata) From b502b3f1e97e6de2b39e4655ded0eaf0910a0f09 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Fri, 19 May 2023 08:49:17 +0200 Subject: [PATCH 07/30] edi_sale: clean file and drop *type_auto dependency --- edi_sale_oca/__manifest__.py | 1 - edi_sale_oca/models/sale_order.py | 27 +++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/edi_sale_oca/__manifest__.py b/edi_sale_oca/__manifest__.py index 40618b6007..b469cdc1f8 100644 --- a/edi_sale_oca/__manifest__.py +++ b/edi_sale_oca/__manifest__.py @@ -14,7 +14,6 @@ "website": "https://github.com/OCA/edi", "depends": [ "edi_oca", - "edi_exchange_type_auto", "edi_record_metadata_oca", "sale_order_import", ], diff --git a/edi_sale_oca/models/sale_order.py b/edi_sale_oca/models/sale_order.py index fa431cab1a..870a9775c7 100644 --- a/edi_sale_oca/models/sale_order.py +++ b/edi_sale_oca/models/sale_order.py @@ -7,15 +7,10 @@ class SaleOrder(models.Model): _name = "sale.order" - _inherit = ["sale.order", "edi.auto.exchange.consumer.mixin"] - - # TODO: this field should be moved to the consumer mixin - # Each extending module should then override `states` as needed. - disable_edi_auto = fields.Boolean( - help="When marked, EDI automatic processing will be avoided", - readonly=True, - states={"draft": [("readonly", False)]}, - ) + _inherit = [ + "sale.order", + "edi.exchange.consumer.mixin", + ] # Receiver may send or not the response on create # then for each update IF required. # https://docs.oasis-open.org/ubl/os-UBL-2.3/UBL-2.3.html#S-ORDERING-POST-AWARD @@ -28,6 +23,14 @@ class SaleOrder(models.Model): # and ask the sender to issue a new order request. # This approach seems suitable only for orders that do not get processed immediately. + # TODO: this field should be moved to the consumer mixin + # Each extending module should then override `states` as needed. + disable_edi_auto = fields.Boolean( + help="When marked, EDI automatic processing will be avoided", + readonly=True, + states={"draft": [("readonly", False)]}, + ) + # edi_record_metadata api def _edi_get_metadata_to_store(self, orig_vals): data = super()._edi_get_metadata_to_store(orig_vals) @@ -44,4 +47,8 @@ def _edi_get_metadata_to_store(self, orig_vals): class SaleOrderLine(models.Model): _name = "sale.order.line" - _inherit = ["sale.order.line", "edi.auto.exchange.consumer.mixin", "edi.id.mixin"] + _inherit = [ + "sale.order.line", + "edi.exchange.consumer.mixin", + "edi.id.mixin", + ] From e07c9cc20251380a8f0a8319b007d8592b7a04f2 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Fri, 19 May 2023 09:37:57 +0200 Subject: [PATCH 08/30] edi_sale: add process hook for order create --- edi_sale_oca/components/process.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/edi_sale_oca/components/process.py b/edi_sale_oca/components/process.py index 33f38ea479..92eda3fd79 100644 --- a/edi_sale_oca/components/process.py +++ b/edi_sale_oca/components/process.py @@ -35,12 +35,7 @@ def process(self): self._handle_existing_order(order, msg) raise UserError(msg) else: - order_id = res["res_id"] - order = self.env["sale.order"].browse(order_id) - if self._order_should_be_confirmed(): - order.action_confirm() - self.exchange_record.sudo()._set_related_record(order) - order._edi_set_origin(self.exchange_record) + order = self._handle_create_order(res["res_id"]) return self.msg_order_created % order.name raise UserError(self.msg_generic_error) @@ -73,6 +68,14 @@ def _get_default_price_source(self): def _order_should_be_confirmed(self): return self.settings.get("confirm_order", False) + def _handle_create_order(self, order_id): + order = self.env["sale.order"].browse(order_id) + self.exchange_record._set_related_record(order) + order._edi_set_origin(self.exchange_record) + if self._order_should_be_confirmed(): + order.action_confirm() + return order + def _handle_existing_order(self, order, message): prev_record = self._get_previous_record(order) self.exchange_record.message_post_with_view( From 24ec539fbb0c466bf50bd701d229106d2cbf2fcb Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Fri, 19 May 2023 15:25:24 +0200 Subject: [PATCH 09/30] edi_sale: process propagate edi origin --- edi_sale_oca/components/process.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/edi_sale_oca/components/process.py b/edi_sale_oca/components/process.py index 92eda3fd79..4b31fd892d 100644 --- a/edi_sale_oca/components/process.py +++ b/edi_sale_oca/components/process.py @@ -54,6 +54,11 @@ def msg_generic_error(self): def _setup_wizard(self): """Init a `sale.order.import` instance for current record.""" ctx = self.settings.get("wiz_ctx", {}) + # Set the right EDI origin on both order and lines + edi_defaults = {"origin_exchange_record_id": self.exchange_record.id} + ctx["sale_order_import__default_vals"] = dict( + order=edi_defaults, lines=edi_defaults + ) wiz = self.env["sale.order.import"].with_context(**ctx).sudo().create({}) wiz.order_file = self.exchange_record._get_file_content(binary=False) wiz.order_filename = self.exchange_record.exchange_filename @@ -71,7 +76,6 @@ def _order_should_be_confirmed(self): def _handle_create_order(self, order_id): order = self.env["sale.order"].browse(order_id) self.exchange_record._set_related_record(order) - order._edi_set_origin(self.exchange_record) if self._order_should_be_confirmed(): order.action_confirm() return order From 482b1487647984485a9b5dc323dd45c453b21120 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Tue, 23 May 2023 08:36:49 +0200 Subject: [PATCH 10/30] edi_sale: add edi_exchange_ready --- edi_sale_oca/models/sale_order.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/edi_sale_oca/models/sale_order.py b/edi_sale_oca/models/sale_order.py index 870a9775c7..bb1350af88 100644 --- a/edi_sale_oca/models/sale_order.py +++ b/edi_sale_oca/models/sale_order.py @@ -2,7 +2,7 @@ # @author: Simone Orsi # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import api, fields, models class SaleOrder(models.Model): @@ -52,3 +52,22 @@ class SaleOrderLine(models.Model): "edi.exchange.consumer.mixin", "edi.id.mixin", ] + + # TODO: add test + edi_exchange_ready = fields.Boolean(compute="_compute_edi_exchange_ready") + + @api.depends() + def _compute_edi_exchange_ready(self): + for rec in self: + rec.edi_exchange_ready = rec._edi_exchange_ready() + + def _edi_exchange_ready(self): + # TODO: not sure we want to exclude lines w/o qty. + # We could have lines that are replaced and kept w/ no qty. + # ATM we don't give full info on replacements on such lines. + # Lines are simply marked as changed. + return ( + not self._is_delivery() + and not self.display_type + and bool(self.product_uom_qty) + ) From 9a86b110e20b767ec9f2b25b66c2f01ae563011a Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Fri, 26 May 2023 18:15:47 +0200 Subject: [PATCH 11/30] edi_sale: fix edi disable flag --- edi_sale_oca/models/sale_order.py | 6 ++---- edi_sale_oca/views/sale_order.xml | 5 ++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/edi_sale_oca/models/sale_order.py b/edi_sale_oca/models/sale_order.py index bb1350af88..1257d25abc 100644 --- a/edi_sale_oca/models/sale_order.py +++ b/edi_sale_oca/models/sale_order.py @@ -23,11 +23,7 @@ class SaleOrder(models.Model): # and ask the sender to issue a new order request. # This approach seems suitable only for orders that do not get processed immediately. - # TODO: this field should be moved to the consumer mixin - # Each extending module should then override `states` as needed. disable_edi_auto = fields.Boolean( - help="When marked, EDI automatic processing will be avoided", - readonly=True, states={"draft": [("readonly", False)]}, ) @@ -53,6 +49,8 @@ class SaleOrderLine(models.Model): "edi.id.mixin", ] + disable_edi_auto = fields.Boolean(related="order_id.disable_edi_auto") + # TODO: add test edi_exchange_ready = fields.Boolean(compute="_compute_edi_exchange_ready") diff --git a/edi_sale_oca/views/sale_order.xml b/edi_sale_oca/views/sale_order.xml index 61635df466..a95bd268f3 100644 --- a/edi_sale_oca/views/sale_order.xml +++ b/edi_sale_oca/views/sale_order.xml @@ -10,7 +10,10 @@ - + From da06fa36a1d9d04dcf2b39edea7aae909b4fb613 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Thu, 6 Jul 2023 13:26:38 +0200 Subject: [PATCH 12/30] edi_sale: fix _edi_exchange_ready for qty=0 Lines w/ no qty must not be excluded a priori --- edi_sale_oca/models/sale_order.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/edi_sale_oca/models/sale_order.py b/edi_sale_oca/models/sale_order.py index 1257d25abc..891ec196b9 100644 --- a/edi_sale_oca/models/sale_order.py +++ b/edi_sale_oca/models/sale_order.py @@ -60,12 +60,4 @@ def _compute_edi_exchange_ready(self): rec.edi_exchange_ready = rec._edi_exchange_ready() def _edi_exchange_ready(self): - # TODO: not sure we want to exclude lines w/o qty. - # We could have lines that are replaced and kept w/ no qty. - # ATM we don't give full info on replacements on such lines. - # Lines are simply marked as changed. - return ( - not self._is_delivery() - and not self.display_type - and bool(self.product_uom_qty) - ) + return not self._is_delivery() and not self.display_type From f6f078e8c2e55b724506ba2fc5320877c14214c6 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Mon, 7 Aug 2023 16:04:46 +0200 Subject: [PATCH 13/30] edi_sale: move OrderMixin from edi_sale_ubl --- edi_sale_oca/tests/common.py | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 edi_sale_oca/tests/common.py diff --git a/edi_sale_oca/tests/common.py b/edi_sale_oca/tests/common.py new file mode 100644 index 0000000000..2fc1f15406 --- /dev/null +++ b/edi_sale_oca/tests/common.py @@ -0,0 +1,50 @@ +# Copyright 2022 Camptocamp SA +# @author: Simone Orsi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields + + +class OrderMixin(object): + @classmethod + def _create_sale_order(cls, **kw): + """Create a sale order + + :return: sale order + """ + model = cls.env["sale.order"] + vals = dict(commitment_date=fields.Date.today()) + vals.update(kw) + so_vals = model.play_onchanges(vals, []) + if "order_line" in so_vals: + so_vals["order_line"] = [(0, 0, x) for x in vals["order_line"]] + return model.create(so_vals) + + @classmethod + def _setup_order(cls, **kw): + cls.product_a = cls.env.ref("product.product_product_4") + cls.product_a.barcode = "1" * 14 + cls.product_b = cls.env.ref("product.product_product_4b") + cls.product_b.barcode = "2" * 14 + cls.product_c = cls.env.ref("product.product_product_4c") + cls.product_c.barcode = "3" * 14 + cls.product_d = cls.env.ref("product.product_product_5") + cls.product_d.barcode = "4" * 14 + line_defaults = kw.pop("line_defaults", {}) + vals = { + "partner_id": cls.env.ref("base.res_partner_10").id, + "commitment_date": "2022-07-29", + } + vals.update(kw) + if "client_order_ref" not in vals: + vals["client_order_ref"] = "ABC123" + vals["order_line"] = [ + {"product_id": cls.product_a.id, "product_uom_qty": 300, "edi_id": 1000}, + {"product_id": cls.product_b.id, "product_uom_qty": 200, "edi_id": 2000}, + {"product_id": cls.product_c.id, "product_uom_qty": 100, "edi_id": 3000}, + ] + if line_defaults: + for line in vals["order_line"]: + line.update(line_defaults) + cls.sale = cls._create_sale_order(**vals) + cls.sale.action_confirm() From 48a81f020bba18bfac0743df0c598db1e7a39e8a Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Mon, 7 Aug 2023 16:07:01 +0200 Subject: [PATCH 14/30] edi_sale: fix test_process --- edi_sale_oca/tests/test_process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edi_sale_oca/tests/test_process.py b/edi_sale_oca/tests/test_process.py index 629a0dc672..633ef24ed0 100644 --- a/edi_sale_oca/tests/test_process.py +++ b/edi_sale_oca/tests/test_process.py @@ -145,7 +145,7 @@ def test_metadata(self): self.wiz_model.with_context( edi_framework_action="process", sale_order_import__default_vals=dict( - origin_exchange_record_id=self.record.id + order=dict(origin_exchange_record_id=self.record.id) ), ).create_order(parsed_order, "pricelist") metadata = self.record.get_metadata() From 35ec71ec4d29bc531a496435b5757467c1558ec4 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Mon, 7 Aug 2023 16:12:53 +0200 Subject: [PATCH 15/30] edi_sale: propagate origin on lines --- edi_sale_oca/models/sale_order.py | 10 +++++++ edi_sale_oca/tests/__init__.py | 1 + edi_sale_oca/tests/test_order.py | 50 +++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 edi_sale_oca/tests/test_order.py diff --git a/edi_sale_oca/models/sale_order.py b/edi_sale_oca/models/sale_order.py index 891ec196b9..7e3f23e29d 100644 --- a/edi_sale_oca/models/sale_order.py +++ b/edi_sale_oca/models/sale_order.py @@ -61,3 +61,13 @@ def _compute_edi_exchange_ready(self): def _edi_exchange_ready(self): return not self._is_delivery() and not self.display_type + + @api.model_create_multi + def create(self, vals_list): + # Set default origin if not passed + for vals in vals_list: + orig_id = vals.get("origin_exchange_record_id") + if not orig_id and "order_id" in vals: + order = self.env["sale.order"].browse(vals["order_id"]) + vals["origin_exchange_record_id"] = order.origin_exchange_record_id.id + return super().create(vals_list) diff --git a/edi_sale_oca/tests/__init__.py b/edi_sale_oca/tests/__init__.py index c2bb451dd1..80e5225788 100644 --- a/edi_sale_oca/tests/__init__.py +++ b/edi_sale_oca/tests/__init__.py @@ -1 +1,2 @@ +from . import test_order from . import test_process diff --git a/edi_sale_oca/tests/test_order.py b/edi_sale_oca/tests/test_order.py new file mode 100644 index 0000000000..3f231c3808 --- /dev/null +++ b/edi_sale_oca/tests/test_order.py @@ -0,0 +1,50 @@ +# Copyright 2022 Camptocamp SA +# @author: Simone Orsi +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + +from odoo.addons.edi_oca.tests.common import EDIBackendTestMixin + +from .common import OrderMixin + + +class TestOrder(SavepointCase, EDIBackendTestMixin, OrderMixin): + @classmethod + def setUpClass(cls): + super().setUpClass() + # force metadata storage w/ proper key + cls.env = cls.env(context=dict(cls.env.context, edi_framework_action=True)) + cls._setup_records() + cls.exchange_type_in.exchange_filename_pattern = "{record.id}-{type.code}-{dt}" + cls.exc_record_in = cls.backend.create_record( + cls.exchange_type_in.code, {"edi_exchange_state": "input_received"} + ) + cls._setup_order( + origin_exchange_record_id=cls.exc_record_in.id, + ) + + def test_line_origin(self): + order = self.sale + self.assertEqual(order.origin_exchange_record_id, self.exc_record_in) + lines = order.order_line + self.env["sale.order.line"].create( + [ + { + "order_id": order.id, + "product_id": self.product_d.id, + "product_uom_qty": 300, + "edi_id": 4000, + }, + { + "order_id": order.id, + "product_id": self.product_d.id, + "product_uom_qty": 400, + "edi_id": 5000, + }, + ] + ) + order.invalidate_cache() + new_line1, new_line2 = order.order_line - lines + self.assertEqual(new_line1.origin_exchange_record_id, self.exc_record_in) + self.assertEqual(new_line2.origin_exchange_record_id, self.exc_record_in) From b1f710e5ff006c437727da09f5d964981ccff309 Mon Sep 17 00:00:00 2001 From: duongtq Date: Wed, 18 Oct 2023 10:55:58 +0700 Subject: [PATCH 16/30] [MIG] edi_sale_oca: Migration to 16.0 --- edi_sale_oca/README.rst | 116 +++++- edi_sale_oca/__manifest__.py | 4 +- edi_sale_oca/components/process.py | 14 +- edi_sale_oca/models/sale_order.py | 4 +- edi_sale_oca/readme/CONTRIBUTORS.rst | 1 + edi_sale_oca/readme/CREDITS.rst | 1 + edi_sale_oca/readme/DESCRIPTION.rst | 4 +- edi_sale_oca/static/description/index.html | 447 +++++++++++++++++++++ edi_sale_oca/tests/test_order.py | 6 +- edi_sale_oca/tests/test_process.py | 26 +- edi_sale_oca/views/sale_order.xml | 4 +- 11 files changed, 582 insertions(+), 45 deletions(-) create mode 100644 edi_sale_oca/readme/CREDITS.rst create mode 100644 edi_sale_oca/static/description/index.html diff --git a/edi_sale_oca/README.rst b/edi_sale_oca/README.rst index 40734932d4..2897e4ddd4 100644 --- a/edi_sale_oca/README.rst +++ b/edi_sale_oca/README.rst @@ -1 +1,115 @@ -bot yet to come +========= +EDI Sales +========= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:a15a65af9b9ffa6808d4901942982eb8467aa13f7c1ac65c07f8751ccbceeff7 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :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--framework-lightgray.png?logo=github + :target: https://github.com/OCA/edi-framework/tree/16.0/edi_sale_oca + :alt: OCA/edi-framework +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/edi-framework-16-0/edi-framework-16-0-edi_sale_oca + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/edi-framework&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Inbound +~~~~~~~ +Receive sale orders from EDI channels. + +Control sale order confirmation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can decide if the order should be confirmed by exchange type. + +On your exchange type, go to advanced settings and add the following:: + + [...] + components: + process: + usage: input.process.sale.order + [...] + sale_order: + default_confirm_order: true + + +TODO: shall we add an exchange type example as demo? + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Simone Orsi +* Duong (Tran Quoc) + +Other credits +~~~~~~~~~~~~~ + +The migration of this module from 14.0 to 16.0 was financially supported by Camptocamp. + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-simahawk| image:: https://github.com/simahawk.png?size=40px + :target: https://github.com/simahawk + :alt: simahawk + +Current `maintainer `__: + +|maintainer-simahawk| + +This module is part of the `OCA/edi-framework `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/edi_sale_oca/__manifest__.py b/edi_sale_oca/__manifest__.py index b469cdc1f8..901509357b 100644 --- a/edi_sale_oca/__manifest__.py +++ b/edi_sale_oca/__manifest__.py @@ -6,12 +6,12 @@ "summary": """ Configuration and special behaviors for EDI on sales. """, - "version": "14.0.1.0.0", + "version": "16.0.1.0.0", "development_status": "Alpha", "license": "AGPL-3", "author": "Camptocamp,Odoo Community Association (OCA)", "maintainers": ["simahawk"], - "website": "https://github.com/OCA/edi", + "website": "https://github.com/OCA/edi-framework", "depends": [ "edi_oca", "edi_record_metadata_oca", diff --git a/edi_sale_oca/components/process.py b/edi_sale_oca/components/process.py index 4b31fd892d..61dbf53f7e 100644 --- a/edi_sale_oca/components/process.py +++ b/edi_sale_oca/components/process.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api +from odoo import _ from odoo.exceptions import UserError from odoo.addons.component.core import Component @@ -63,27 +63,17 @@ def _setup_wizard(self): wiz.order_file = self.exchange_record._get_file_content(binary=False) wiz.order_filename = self.exchange_record.exchange_filename wiz.order_file_change() - wiz.price_source = self._get_default_price_source() return wiz - @api.model - def _get_default_price_source(self): - return self.settings.get("price_source", "pricelist") - - def _order_should_be_confirmed(self): - return self.settings.get("confirm_order", False) - def _handle_create_order(self, order_id): order = self.env["sale.order"].browse(order_id) self.exchange_record._set_related_record(order) - if self._order_should_be_confirmed(): - order.action_confirm() return order def _handle_existing_order(self, order, message): prev_record = self._get_previous_record(order) self.exchange_record.message_post_with_view( - "edi_sale_order_import.message_already_imported", + "edi_sale_oca.message_already_imported", values={ "order": order, "prev_record": prev_record, diff --git a/edi_sale_oca/models/sale_order.py b/edi_sale_oca/models/sale_order.py index 7e3f23e29d..bd025230fa 100644 --- a/edi_sale_oca/models/sale_order.py +++ b/edi_sale_oca/models/sale_order.py @@ -23,7 +23,7 @@ class SaleOrder(models.Model): # and ask the sender to issue a new order request. # This approach seems suitable only for orders that do not get processed immediately. - disable_edi_auto = fields.Boolean( + edi_disable_auto = fields.Boolean( states={"draft": [("readonly", False)]}, ) @@ -49,7 +49,7 @@ class SaleOrderLine(models.Model): "edi.id.mixin", ] - disable_edi_auto = fields.Boolean(related="order_id.disable_edi_auto") + edi_disable_auto = fields.Boolean(related="order_id.edi_disable_auto") # TODO: add test edi_exchange_ready = fields.Boolean(compute="_compute_edi_exchange_ready") diff --git a/edi_sale_oca/readme/CONTRIBUTORS.rst b/edi_sale_oca/readme/CONTRIBUTORS.rst index f1c71bce18..20b0da9369 100644 --- a/edi_sale_oca/readme/CONTRIBUTORS.rst +++ b/edi_sale_oca/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Simone Orsi +* Duong (Tran Quoc) diff --git a/edi_sale_oca/readme/CREDITS.rst b/edi_sale_oca/readme/CREDITS.rst new file mode 100644 index 0000000000..4c5b2fca2a --- /dev/null +++ b/edi_sale_oca/readme/CREDITS.rst @@ -0,0 +1 @@ +The migration of this module from 14.0 to 16.0 was financially supported by Camptocamp. diff --git a/edi_sale_oca/readme/DESCRIPTION.rst b/edi_sale_oca/readme/DESCRIPTION.rst index c66a89709d..b112900990 100644 --- a/edi_sale_oca/readme/DESCRIPTION.rst +++ b/edi_sale_oca/readme/DESCRIPTION.rst @@ -1,5 +1,3 @@ -TODO - Inbound ~~~~~~~ Receive sale orders from EDI channels. @@ -17,7 +15,7 @@ On your exchange type, go to advanced settings and add the following:: usage: input.process.sale.order [...] sale_order: - confirm_order: true + default_confirm_order: true TODO: shall we add an exchange type example as demo? diff --git a/edi_sale_oca/static/description/index.html b/edi_sale_oca/static/description/index.html new file mode 100644 index 0000000000..eada31a830 --- /dev/null +++ b/edi_sale_oca/static/description/index.html @@ -0,0 +1,447 @@ + + + + + + +EDI Sales + + + +
+

EDI Sales

+ + +

Alpha License: AGPL-3 OCA/edi-framework Translate me on Weblate Try me on Runboat

+
+

Inbound

+

Receive sale orders from EDI channels.

+
+
+

Control sale order confirmation

+

You can decide if the order should be confirmed by exchange type.

+

On your exchange type, go to advanced settings and add the following:

+
+[...]
+components:
+    process:
+        usage: input.process.sale.order
+[...]
+sale_order:
+    default_confirm_order: true
+
+

TODO: shall we add an exchange type example as demo?

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+ +
+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

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

+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

simahawk

+

This module is part of the OCA/edi-framework project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+ + diff --git a/edi_sale_oca/tests/test_order.py b/edi_sale_oca/tests/test_order.py index 3f231c3808..ad91d79c2d 100644 --- a/edi_sale_oca/tests/test_order.py +++ b/edi_sale_oca/tests/test_order.py @@ -2,14 +2,14 @@ # @author: Simone Orsi # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests.common import SavepointCase +from odoo.tests.common import TransactionCase from odoo.addons.edi_oca.tests.common import EDIBackendTestMixin from .common import OrderMixin -class TestOrder(SavepointCase, EDIBackendTestMixin, OrderMixin): +class TestOrder(TransactionCase, EDIBackendTestMixin, OrderMixin): @classmethod def setUpClass(cls): super().setUpClass() @@ -44,7 +44,7 @@ def test_line_origin(self): }, ] ) - order.invalidate_cache() + order.env.invalidate_all() new_line1, new_line2 = order.order_line - lines self.assertEqual(new_line1.origin_exchange_record_id, self.exc_record_in) self.assertEqual(new_line2.origin_exchange_record_id, self.exc_record_in) diff --git a/edi_sale_oca/tests/test_process.py b/edi_sale_oca/tests/test_process.py index 633ef24ed0..1ec85332c2 100644 --- a/edi_sale_oca/tests/test_process.py +++ b/edi_sale_oca/tests/test_process.py @@ -4,14 +4,13 @@ import base64 import textwrap +from unittest import mock -import mock - -from odoo.addons.component.tests.common import SavepointComponentCase +from odoo.addons.component.tests.common import TransactionComponentCase from odoo.addons.edi_oca.tests.common import EDIBackendTestMixin -class TestProcessComponent(SavepointComponentCase, EDIBackendTestMixin): +class TestProcessComponent(TransactionComponentCase, EDIBackendTestMixin): @classmethod def setUpClass(cls): super().setUpClass() @@ -24,6 +23,7 @@ def setUpClass(cls): exchange_file_ext="xml", exchange_filename_pattern="{record.identifier}-{type.code}-{dt}", backend_id=cls.backend.id, + # Bypass required fields with default_import_type = 'xml' in sale_order_import advanced_settings_edit=textwrap.dedent( """ components: @@ -32,6 +32,8 @@ def setUpClass(cls): sale_order_import: wiz_ctx: random_key: custom + default_price_source: 'pricelist' + default_import_type: 'xml' """ ), ) @@ -60,21 +62,6 @@ def test_wizard_setup(self): self.assertEqual(wiz.price_source, "pricelist") md_onchange.assert_called() - def test_settings(self): - self.exc_type.advanced_settings_edit = textwrap.dedent( - """ - components: - process: - usage: input.process.sale.order - sale_order_import: - price_source: order - confirm_order: true - """ - ) - comp = self.backend._get_component(self.record, "process") - self.assertEqual(comp._get_default_price_source(), "order") - self.assertTrue(comp._order_should_be_confirmed()) - # In both tests here we don"t care about the specific format of the import. # We only care that the wizard plugged with the component works as expected. def test_existing_order(self): @@ -155,7 +142,6 @@ def test_metadata(self): "product_id", "product_uom_qty", "product_uom", - "name", "price_unit", "edi_id", ): diff --git a/edi_sale_oca/views/sale_order.xml b/edi_sale_oca/views/sale_order.xml index a95bd268f3..857129b383 100644 --- a/edi_sale_oca/views/sale_order.xml +++ b/edi_sale_oca/views/sale_order.xml @@ -11,7 +11,7 @@ @@ -42,7 +42,7 @@
From c20328469abec1e58e168d4c14cdf2c71f26c6db Mon Sep 17 00:00:00 2001 From: duongtq Date: Wed, 18 Oct 2023 10:59:36 +0700 Subject: [PATCH 17/30] [IMP] edi_sale_oca: Support edi_id for edi_sale_edifact_oca --- edi_sale_oca/wizard/sale_order_import.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/edi_sale_oca/wizard/sale_order_import.py b/edi_sale_oca/wizard/sale_order_import.py index cdb25a5967..81a30e8f95 100644 --- a/edi_sale_oca/wizard/sale_order_import.py +++ b/edi_sale_oca/wizard/sale_order_import.py @@ -18,5 +18,7 @@ def _prepare_create_order_line( ) # TODO: we should probably add an ext reference field to s.o.l. in sale_order_import # and get rid of this override. - vals["edi_id"] = import_line.get("order_line_ref") + vals["edi_id"] = import_line.get("order_line_ref") or import_line.get( + "sequence" + ) return vals From 48c754b6ee1b35a578b6b23adad477746333975e Mon Sep 17 00:00:00 2001 From: duongtq Date: Thu, 26 Oct 2023 10:04:46 +0700 Subject: [PATCH 18/30] [IMP] edi_sale_oca: Refactor code for passing all configurations via env_ctx The configurations here are values for the wizard and whatever we need --- edi_sale_oca/README.rst | 16 +++++++++++----- edi_sale_oca/components/process.py | 21 ++++++++------------- edi_sale_oca/readme/DESCRIPTION.rst | 12 +++++++++--- edi_sale_oca/static/description/index.html | 14 ++++++++++---- edi_sale_oca/tests/test_process.py | 9 ++++----- 5 files changed, 42 insertions(+), 30 deletions(-) diff --git a/edi_sale_oca/README.rst b/edi_sale_oca/README.rst index 2897e4ddd4..b0124caf27 100644 --- a/edi_sale_oca/README.rst +++ b/edi_sale_oca/README.rst @@ -7,7 +7,7 @@ EDI Sales !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:a15a65af9b9ffa6808d4901942982eb8467aa13f7c1ac65c07f8751ccbceeff7 + !! source digest: sha256:fb52928e31a51155acf8913e3bded99f8f488dc78beadcf8d6e35bb1f29b1bae !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png @@ -43,10 +43,16 @@ On your exchange type, go to advanced settings and add the following:: components: process: usage: input.process.sale.order - [...] - sale_order: - default_confirm_order: true - + env_ctx: + # Values for the wizard + default_confirm_order: true + default_price_source: order + # Custom keys, whatever you need + random_one: true + +Note that `env_ctx` will propagate all keys to the whole env so you can use it +for any kind of context related configuration. In the case of the sale order import wizard +here we are just passing defaults as we could do in odoo standard. TODO: shall we add an exchange type example as demo? diff --git a/edi_sale_oca/components/process.py b/edi_sale_oca/components/process.py index 61dbf53f7e..13bce23e55 100644 --- a/edi_sale_oca/components/process.py +++ b/edi_sale_oca/components/process.py @@ -16,15 +16,6 @@ class EDIExchangeSOInput(Component): _inherit = "edi.component.input.mixin" _usage = "input.process.sale.order" - def __init__(self, work_context): - super().__init__(work_context) - self.settings = {} - # Suppor legacy key `self.type_settings` - for key in ("sale_order", "sale_order_import"): - if key in self.type_settings: - self.settings = self.type_settings.get(key, {}) - break - def process(self): wiz = self._setup_wizard() res = wiz.import_order_button() @@ -53,13 +44,17 @@ def msg_generic_error(self): def _setup_wizard(self): """Init a `sale.order.import` instance for current record.""" - ctx = self.settings.get("wiz_ctx", {}) # Set the right EDI origin on both order and lines edi_defaults = {"origin_exchange_record_id": self.exchange_record.id} - ctx["sale_order_import__default_vals"] = dict( - order=edi_defaults, lines=edi_defaults + addtional_ctx = dict( + sale_order_import__default_vals=dict(order=edi_defaults, lines=edi_defaults) + ) + wiz = ( + self.env["sale.order.import"] + .with_context(**addtional_ctx) + .sudo() + .create({}) ) - wiz = self.env["sale.order.import"].with_context(**ctx).sudo().create({}) wiz.order_file = self.exchange_record._get_file_content(binary=False) wiz.order_filename = self.exchange_record.exchange_filename wiz.order_file_change() diff --git a/edi_sale_oca/readme/DESCRIPTION.rst b/edi_sale_oca/readme/DESCRIPTION.rst index b112900990..55cdc88ede 100644 --- a/edi_sale_oca/readme/DESCRIPTION.rst +++ b/edi_sale_oca/readme/DESCRIPTION.rst @@ -13,9 +13,15 @@ On your exchange type, go to advanced settings and add the following:: components: process: usage: input.process.sale.order - [...] - sale_order: - default_confirm_order: true + env_ctx: + # Values for the wizard + default_confirm_order: true + default_price_source: order + # Custom keys, whatever you need + random_one: true +Note that `env_ctx` will propagate all keys to the whole env so you can use it +for any kind of context related configuration. In the case of the sale order import wizard +here we are just passing defaults as we could do in odoo standard. TODO: shall we add an exchange type example as demo? diff --git a/edi_sale_oca/static/description/index.html b/edi_sale_oca/static/description/index.html index eada31a830..5afcfd7b5c 100644 --- a/edi_sale_oca/static/description/index.html +++ b/edi_sale_oca/static/description/index.html @@ -367,7 +367,7 @@

EDI Sales

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:a15a65af9b9ffa6808d4901942982eb8467aa13f7c1ac65c07f8751ccbceeff7 +!! source digest: sha256:fb52928e31a51155acf8913e3bded99f8f488dc78beadcf8d6e35bb1f29b1bae !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Alpha License: AGPL-3 OCA/edi-framework Translate me on Weblate Try me on Runboat

@@ -383,10 +383,16 @@

Control sale order confirmation

components: process: usage: input.process.sale.order -[...] -sale_order: - default_confirm_order: true + env_ctx: + # Values for the wizard + default_confirm_order: true + default_price_source: order + # Custom keys, whatever you need + random_one: true +

Note that env_ctx will propagate all keys to the whole env so you can use it +for any kind of context related configuration. In the case of the sale order import wizard +here we are just passing defaults as we could do in odoo standard.

TODO: shall we add an exchange type example as demo?

Important

diff --git a/edi_sale_oca/tests/test_process.py b/edi_sale_oca/tests/test_process.py index 1ec85332c2..dbf05bbe37 100644 --- a/edi_sale_oca/tests/test_process.py +++ b/edi_sale_oca/tests/test_process.py @@ -29,11 +29,10 @@ def setUpClass(cls): components: process: usage: input.process.sale.order - sale_order_import: - wiz_ctx: - random_key: custom - default_price_source: 'pricelist' - default_import_type: 'xml' + env_ctx: + default_price_source: 'pricelist' + default_import_type: 'xml' + random_key: custom """ ), ) From 01469d868748a148dc59141724672f1fe8a967d8 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Tue, 21 Nov 2023 09:00:04 +0000 Subject: [PATCH 19/30] [UPD] Update edi_sale_oca.pot --- edi_sale_oca/i18n/edi_sale_oca.pot | 176 +++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 edi_sale_oca/i18n/edi_sale_oca.pot diff --git a/edi_sale_oca/i18n/edi_sale_oca.pot b/edi_sale_oca/i18n/edi_sale_oca.pot new file mode 100644 index 0000000000..55c4deef76 --- /dev/null +++ b/edi_sale_oca/i18n/edi_sale_oca.pot @@ -0,0 +1,176 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * edi_sale_oca +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: edi_sale_oca +#: model_terms:ir.ui.view,arch_db:edi_sale_oca.view_order_form +msgid "EDI" +msgstr "" + +#. module: edi_sale_oca +#: model_terms:ir.ui.view,arch_db:edi_sale_oca.message_already_imported +msgid "Message:" +msgstr "" + +#. module: edi_sale_oca +#: model_terms:ir.ui.view,arch_db:edi_sale_oca.message_already_imported +msgid "Order:" +msgstr "" + +#. module: edi_sale_oca +#: model_terms:ir.ui.view,arch_db:edi_sale_oca.message_already_imported +msgid "Previous record:" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order__edi_disable_auto +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order_line__edi_disable_auto +msgid "Disable auto" +msgstr "" + +#. module: edi_sale_oca +#: model_terms:ir.ui.view,arch_db:edi_sale_oca.view_order_form +msgid "Disable automated actions" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.ui.menu,name:edi_sale_oca.menu_sale_edi_root +#: model_terms:ir.ui.view,arch_db:edi_sale_oca.view_order_form +#: model_terms:ir.ui.view,arch_db:edi_sale_oca.view_partner_form +msgid "EDI" +msgstr "" + +#. module: edi_sale_oca +#: model_terms:ir.ui.view,arch_db:edi_sale_oca.view_sales_order_filter +msgid "EDI exchange" +msgstr "" + +#. module: edi_sale_oca +#: model_terms:ir.ui.view,arch_db:edi_sale_oca.view_sales_order_filter +msgid "EDI exchange type" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order__origin_exchange_type_id +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order_line__origin_exchange_type_id +msgid "EDI origin exchange type" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order__origin_exchange_record_id +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order_line__origin_exchange_record_id +msgid "EDI origin record" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,help:edi_sale_oca.field_sale_order__origin_exchange_record_id +#: model:ir.model.fields,help:edi_sale_oca.field_sale_order_line__origin_exchange_record_id +msgid "EDI record that originated this document." +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order_line__edi_id +msgid "Edi" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order__edi_config +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order_line__edi_config +msgid "Edi Config" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order_line__edi_exchange_ready +msgid "Edi Exchange Ready" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order__edi_has_form_config +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order_line__edi_has_form_config +msgid "Edi Has Form Config" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order__exchange_record_ids +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order_line__exchange_record_ids +msgid "Exchange Record" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order__exchange_record_count +#: model:ir.model.fields,field_description:edi_sale_oca.field_sale_order_line__exchange_record_count +msgid "Exchange Record Count" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.ui.menu,name:edi_sale_oca.menu_sale_edi_records +msgid "Exchanges" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,help:edi_sale_oca.field_sale_order_line__edi_id +msgid "Internal or external identifier for records." +msgstr "" + +#. module: edi_sale_oca +#: model:ir.actions.act_window,name:edi_sale_oca.act_open_edi_exchange_record_sale_order_view +msgid "Sale Order Exchange Records" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model,name:edi_sale_oca.model_sale_order_import +msgid "Sale Order Import from Files" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model,name:edi_sale_oca.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model,name:edi_sale_oca.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + +#. module: edi_sale_oca +#. odoo-python +#: code:addons/edi_sale_oca/components/process.py:0 +#, python-format +msgid "Sales order %s created" +msgstr "" + +#. module: edi_sale_oca +#. odoo-python +#: code:addons/edi_sale_oca/components/process.py:0 +#, python-format +msgid "Sales order has already been imported before" +msgstr "" + +#. module: edi_sale_oca +#. odoo-python +#: code:addons/edi_sale_oca/components/process.py:0 +#, python-format +msgid "Something went wrong with the importing wizard." +msgstr "" + +#. module: edi_sale_oca +#: model_terms:ir.ui.view,arch_db:edi_sale_oca.view_sales_order_filter +msgid "Source: EDI" +msgstr "" + +#. module: edi_sale_oca +#: model:ir.model.fields,help:edi_sale_oca.field_sale_order__edi_disable_auto +#: model:ir.model.fields,help:edi_sale_oca.field_sale_order_line__edi_disable_auto +msgid "When marked, EDI automatic processing will be avoided" +msgstr "" From fd73801f517ef4787cc3f49a8c0b45cbdbc3248e Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 21 Nov 2023 09:02:26 +0000 Subject: [PATCH 20/30] [BOT] post-merge updates --- edi_sale_oca/README.rst | 2 +- edi_sale_oca/static/description/icon.png | Bin 0 -> 9455 bytes edi_sale_oca/static/description/index.html | 22 ++++++++++----------- 3 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 edi_sale_oca/static/description/icon.png diff --git a/edi_sale_oca/README.rst b/edi_sale_oca/README.rst index b0124caf27..8e35d63043 100644 --- a/edi_sale_oca/README.rst +++ b/edi_sale_oca/README.rst @@ -7,7 +7,7 @@ EDI Sales !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:fb52928e31a51155acf8913e3bded99f8f488dc78beadcf8d6e35bb1f29b1bae + !! source digest: sha256:5fcc2020f8975d9b8c3b277ca820d949c0e52fa907f0c00959ad9ec751105d5d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png diff --git a/edi_sale_oca/static/description/icon.png b/edi_sale_oca/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o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yrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/edi_sale_oca/static/description/index.html b/edi_sale_oca/static/description/index.html index 5afcfd7b5c..fbc6682028 100644 --- a/edi_sale_oca/static/description/index.html +++ b/edi_sale_oca/static/description/index.html @@ -1,20 +1,20 @@ - + - + EDI Sales