From 6f64596c2bf2174e94e1619493ae64d49168ebb6 Mon Sep 17 00:00:00 2001 From: thien Date: Thu, 18 Jul 2024 10:49:06 +0700 Subject: [PATCH] [UPD] edi_purchase_oca: Update for edi configuration --- edi_purchase_oca/__init__.py | 1 + edi_purchase_oca/__manifest__.py | 7 +- edi_purchase_oca/components/__init__.py | 1 + .../components/listener_purchase_order.py | 16 ++++ edi_purchase_oca/data/edi_configuration.xml | 10 +- edi_purchase_oca/models/__init__.py | 2 + edi_purchase_oca/models/edi_configuration.py | 19 ++++ edi_purchase_oca/models/purchase_order.py | 12 ++- edi_purchase_oca/models/res_partner.py | 3 +- edi_purchase_oca/tests/__init__.py | 1 + .../tests/test_edi_configuration.py | 91 +++++++++++++++++++ edi_purchase_oca/views/res_partner_view.xml | 17 ++-- 12 files changed, 161 insertions(+), 19 deletions(-) create mode 100644 edi_purchase_oca/components/__init__.py create mode 100644 edi_purchase_oca/components/listener_purchase_order.py create mode 100644 edi_purchase_oca/models/edi_configuration.py create mode 100644 edi_purchase_oca/tests/__init__.py create mode 100644 edi_purchase_oca/tests/test_edi_configuration.py diff --git a/edi_purchase_oca/__init__.py b/edi_purchase_oca/__init__.py index 0650744f6bc..0f00a6730df 100644 --- a/edi_purchase_oca/__init__.py +++ b/edi_purchase_oca/__init__.py @@ -1 +1,2 @@ from . import models +from . import components diff --git a/edi_purchase_oca/__manifest__.py b/edi_purchase_oca/__manifest__.py index be446cd4047..46c835cab47 100644 --- a/edi_purchase_oca/__manifest__.py +++ b/edi_purchase_oca/__manifest__.py @@ -10,6 +10,11 @@ "author": "ForgeFlow, Odoo Community Association (OCA)", "website": "https://github.com/OCA/edi", "depends": ["purchase", "edi_oca", "component_event"], - "data": ["views/purchase_order_views.xml", "views/edi_exchange_record_views.xml"], + "data": [ + "views/purchase_order_views.xml", + "views/edi_exchange_record_views.xml", + "views/res_partner_view.xml", + "data/edi_configuration.xml", + ], "demo": [], } diff --git a/edi_purchase_oca/components/__init__.py b/edi_purchase_oca/components/__init__.py new file mode 100644 index 00000000000..3d4a3c96a27 --- /dev/null +++ b/edi_purchase_oca/components/__init__.py @@ -0,0 +1 @@ +from . import listener_purchase_order diff --git a/edi_purchase_oca/components/listener_purchase_order.py b/edi_purchase_oca/components/listener_purchase_order.py new file mode 100644 index 00000000000..3435f94bc11 --- /dev/null +++ b/edi_purchase_oca/components/listener_purchase_order.py @@ -0,0 +1,16 @@ +# Copyright 2024 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.addons.component.core import Component + + +class EDIConfigPurchaseListener(Component): + _name = "edi.listener.config.purchase.order" + _inherit = "base.event.listener" + _apply_on = ["purchase.order"] + + def on_button_confirm_purchase_order(self, record): + trigger = "on_button_confirm_purchase_order" + confs = record.partner_id.edi_purchase_conf_ids.edi_get_conf(trigger) + for conf in confs: + conf.edi_exec_snippet_do(record) diff --git a/edi_purchase_oca/data/edi_configuration.xml b/edi_purchase_oca/data/edi_configuration.xml index 68cb404eab6..f4317913a2f 100644 --- a/edi_purchase_oca/data/edi_configuration.xml +++ b/edi_purchase_oca/data/edi_configuration.xml @@ -4,16 +4,16 @@ Purchase Confirmation Config on_button_confirm_purchase_order on_button_confirm_purchase_order - + - result={ - "snippet_var_do": {} - } +result={ + "snippet_var_do": {} +} - Send EDI Quoctation Config + Send EDI Quotation Config send_via_email_rfq send_via_email_rfq + res.partner.form.inherit.sales_purchases res.partner - - - - + + + + + +