From 72d83abb93cc92999c299200442498779d86ab53 Mon Sep 17 00:00:00 2001 From: "Claire Bretton (clbr)" Date: Tue, 3 Oct 2023 11:33:49 +0200 Subject: [PATCH] [FIX] {l10n_}account_edi_ubl_cii{_tests},account_peppol: change label of checkbox and fix dependency 1. Rename checkbox "Peppol BIS Billing 3.0" to "BIS Billing 3.0" to avoid confusion with the incoming one we will add with the full support of Peppol. 2. There was a buggy interaction between mail checkbox and BIS Billing checkbox in the Send & Print: If the Peppol BIS Billing was checked, then uncheck/check the Email box, the Peppol BIS Billing unchecks automatically. They should be independent. Task-id:3525932 closes odoo/odoo#137382 Related: odoo/enterprise#48318 Signed-off-by: Florian Gilbert (flg) --- addons/account_edi_ubl_cii/models/account_move_send.py | 7 +++---- addons/account_edi_ubl_cii/models/res_partner.py | 10 +++++----- addons/account_peppol/wizard/account_move_send.py | 8 +++----- .../tests/test_xml_ubl_be.py | 4 ++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/addons/account_edi_ubl_cii/models/account_move_send.py b/addons/account_edi_ubl_cii/models/account_move_send.py index 7e5702da7c5..4563142618a 100644 --- a/addons/account_edi_ubl_cii/models/account_move_send.py +++ b/addons/account_edi_ubl_cii/models/account_move_send.py @@ -16,7 +16,7 @@ _logger = logging.getLogger(__name__) class AccountMoveSend(models.Model): _inherit = 'account.move.send' - enable_ubl_cii_xml = fields.Boolean(compute='_compute_send_mail_extra_fields') + enable_ubl_cii_xml = fields.Boolean(compute='_compute_enable_ubl_cii_xml') checkbox_ubl_cii_label = fields.Char(compute='_compute_checkbox_ubl_cii_label') checkbox_ubl_cii_xml = fields.Boolean(compute='_compute_checkbox_ubl_cii_xml', store=True, readonly=False) @@ -40,9 +40,8 @@ class AccountMoveSend(models.Model): if any(codes): wizard.checkbox_ubl_cii_label = ", ".join(code_to_label[c] for c in set(codes) if c) - def _compute_send_mail_extra_fields(self): - # EXTENDS 'account' - super()._compute_send_mail_extra_fields() + @api.depends('move_ids') + def _compute_enable_ubl_cii_xml(self): for wizard in self: wizard.enable_ubl_cii_xml = any(m._need_ubl_cii_xml() for m in wizard.move_ids) diff --git a/addons/account_edi_ubl_cii/models/res_partner.py b/addons/account_edi_ubl_cii/models/res_partner.py index de2aab9330a..b5c2c9159fb 100644 --- a/addons/account_edi_ubl_cii/models/res_partner.py +++ b/addons/account_edi_ubl_cii/models/res_partner.py @@ -12,11 +12,11 @@ class ResPartner(models.Model): string="Format", selection=[ ('facturx', "Factur-X (CII)"), - ('ubl_bis3', "Peppol BIS Billing 3.0"), + ('ubl_bis3', "BIS Billing 3.0"), ('xrechnung', "XRechnung CIUS"), ('nlcius', "NLCIUS"), - ('ubl_a_nz', "Peppol BIS Billing 3.0 A-NZ"), - ('ubl_sg', "Peppol BIS Billing 3.0 SG"), + ('ubl_a_nz', "BIS Billing 3.0 A-NZ"), + ('ubl_sg', "BIS Billing 3.0 SG"), ], compute='_compute_ubl_cii_format', store=True, @@ -24,7 +24,7 @@ class ResPartner(models.Model): ) peppol_endpoint = fields.Char( string="Peppol Endpoint", - help="Unique identifier used by the Peppol BIS Billing 3.0 and its derivatives, also known as 'Endpoint ID'.", + help="Unique identifier used by the BIS Billing 3.0 and its derivatives, also known as 'Endpoint ID'.", compute="_compute_peppol_endpoint", store=True, readonly=False, @@ -32,7 +32,7 @@ class ResPartner(models.Model): ) peppol_eas = fields.Selection( string="Peppol e-address (EAS)", - help="""Code used to identify the Endpoint for Peppol BIS Billing 3.0 and its derivatives. + help="""Code used to identify the Endpoint for BIS Billing 3.0 and its derivatives. List available at https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/""", compute="_compute_peppol_eas", store=True, diff --git a/addons/account_peppol/wizard/account_move_send.py b/addons/account_peppol/wizard/account_move_send.py index 96d4307e39d..7235d69072a 100644 --- a/addons/account_peppol/wizard/account_move_send.py +++ b/addons/account_peppol/wizard/account_move_send.py @@ -15,7 +15,7 @@ class AccountMoveSend(models.Model): compute='_compute_checkbox_send_peppol', store=True, readonly=False, help='Send the invoice via PEPPOL', ) - enable_peppol = fields.Boolean(compute='_compute_send_mail_extra_fields') + enable_peppol = fields.Boolean(compute='_compute_enable_peppol') # technical field needed for computing a warning text about the peppol configuration peppol_warning = fields.Char( string="Warning", @@ -58,10 +58,8 @@ class AccountMoveSend(models.Model): "Please check and verify their Peppol endpoint and the Electronic Invoicing format: " "%s", names) - def _compute_send_mail_extra_fields(self): - # Extends 'account' - super()._compute_send_mail_extra_fields() - + @api.depends('enable_ubl_cii_xml') + def _compute_enable_peppol(self): for wizard in self: # show peppol option if either the ubl option is available or any move already has a ubl file generated # and moves are not processing/done diff --git a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py index 7f83e6a9ef6..a2749457576 100644 --- a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py +++ b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py @@ -628,7 +628,7 @@ class TestUBLBE(TestUBLCommon, TestAccountMoveSendCommon): wizard._compute_send_mail_extra_fields() self.assertRecordValues(wizard, [{ 'mode': 'invoice_single', - 'checkbox_ubl_cii_label': "Peppol BIS Billing 3.0", + 'checkbox_ubl_cii_label': "BIS Billing 3.0", 'enable_ubl_cii_xml': True, 'checkbox_ubl_cii_xml': True, }]) @@ -662,7 +662,7 @@ class TestUBLBE(TestUBLCommon, TestAccountMoveSendCommon): wizard = self.create_send_and_print(invoice) self.assertRecordValues(wizard, [{ 'mode': 'invoice_single', - 'checkbox_ubl_cii_label': 'Peppol BIS Billing 3.0', + 'checkbox_ubl_cii_label': 'BIS Billing 3.0', 'enable_ubl_cii_xml': False, 'checkbox_ubl_cii_xml': False, }])