From c318734d45b57b782e57fc7441bcb8ac796181f4 Mon Sep 17 00:00:00 2001 From: aliya Date: Mon, 15 Apr 2024 12:53:33 +0000 Subject: [PATCH] [FIX] account_edi_ubl_cii: remove deprecated peppol eas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of April 1, 2024, the migration period set by the Peppol Authority of Finland for the requirement specified in the Peppol Authority Specific Requirements document has ended. According to this requirement, Finnish end users’ Peppol addresses (participant identifiers) must adhere to the ISO 6523 code list 0216 OVT-format. Other address types are not allowed for Finnish end users. See also: [Finland Peppol Authority requirements](https://peppol.org/wp-content/uploads/2023/08/Finland-Peppol-Authority-Specific-Requirements.pdf) [Finland Peppol Authority website](https://www.valtiokonttori.fi/en/service/the-state-treasury-is-the-finnish-peppol-authority/#for-service-providers_authority-specific-requirements-in-finland) It turned out that we have a few others that are no longer used on Peppol. We will remove those in master as well. See: [Peppol codelists](https://docs.peppol.eu/edelivery/codelists/) no task, reported by the Finnish Peppol Authoirty Team closes odoo/odoo#162246 X-original-commit: e4519cd0d73029cc482cc4c34e4a57b1432b4c79 Signed-off-by: Julien Van Roy (juvr) Signed-off-by: Aliya Tastemirova (alta) --- .../i18n/account_edi_ubl_cii.pot | 24 +++++++++++++++++++ .../models/account_edi_common.py | 2 +- .../account_edi_ubl_cii/models/res_partner.py | 10 ++++++++ .../models/res_config_settings.py | 2 ++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot b/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot index d8be396b160..3301079d921 100644 --- a/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot +++ b/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot @@ -727,6 +727,30 @@ msgstr "" msgid "Odoo" msgstr "" +#. module: account_edi_ubl_cii +#. odoo-python +#: code:addons/account_edi_ubl_cii/models/res_partner.py:0 +#, python-format +msgid "" +"Peppol EAS code 9901 is deprecated. Please use a different Danish EAS code " +"instead." +msgstr "" + +#. module: account_edi_ubl_cii +#. odoo-python +#: code:addons/account_edi_ubl_cii/models/res_partner.py:0 +#, python-format +msgid "Peppol EAS code 9955 is deprecated. Please use 0007 instead." +msgstr "" + +#. module: account_edi_ubl_cii +#. odoo-python +#: code:addons/account_edi_ubl_cii/models/res_partner.py:0 +#, python-format +msgid "" +"Peppol EAS codes 0212 and 0213 are deprecated. Please use 0216 instead." +msgstr "" + #. module: account_edi_ubl_cii #: model:ir.model.fields,field_description:account_edi_ubl_cii.field_res_partner__peppol_endpoint #: model:ir.model.fields,field_description:account_edi_ubl_cii.field_res_users__peppol_endpoint diff --git a/addons/account_edi_ubl_cii/models/account_edi_common.py b/addons/account_edi_ubl_cii/models/account_edi_common.py index f1fff941e72..b1314f5ff3e 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_common.py +++ b/addons/account_edi_ubl_cii/models/account_edi_common.py @@ -54,7 +54,7 @@ EAS_MAPPING = { 'DK': {'0184': 'company_registry', '0198': 'vat'}, 'EE': {'9931': 'vat'}, 'ES': {'9920': 'vat'}, - 'FI': {'0213': 'vat'}, + 'FI': {'0216': None}, 'FR': {'0009': 'siret', '9957': 'vat'}, 'SG': {'0195': 'l10n_sg_unique_entity_number'}, 'GB': {'9932': 'vat'}, diff --git a/addons/account_edi_ubl_cii/models/res_partner.py b/addons/account_edi_ubl_cii/models/res_partner.py index 0b23ec264da..603b3de4e9e 100644 --- a/addons/account_edi_ubl_cii/models/res_partner.py +++ b/addons/account_edi_ubl_cii/models/res_partner.py @@ -127,6 +127,16 @@ class ResPartner(models.Model): ] ) + @api.constrains('peppol_eas') + def _check_peppol_eas(self): + for partner in self: + if partner.peppol_eas in ('0212', '0213'): + raise ValidationError(_("Peppol EAS codes 0212 and 0213 are deprecated. Please use 0216 instead.")) + elif partner.peppol_eas == '9955': + raise ValidationError(_("Peppol EAS code 9955 is deprecated. Please use 0007 instead.")) + elif partner.peppol_eas == '9901': + raise ValidationError(_("Peppol EAS code 9901 is deprecated. Please use a different Danish EAS code instead.")) + @api.constrains('peppol_endpoint') def _check_peppol_fields(self): for partner in self: diff --git a/addons/account_peppol/models/res_config_settings.py b/addons/account_peppol/models/res_config_settings.py index 31821497709..1ee5b01a5e4 100644 --- a/addons/account_peppol/models/res_config_settings.py +++ b/addons/account_peppol/models/res_config_settings.py @@ -155,6 +155,8 @@ class ResConfigSettings(models.TransientModel): company = self.company_id edi_proxy_client = self.env['account_edi_proxy_client.user'] edi_identification = edi_proxy_client._get_proxy_identification(company, 'peppol') + company.partner_id._check_peppol_eas() + if company.partner_id._check_peppol_participant_exists(edi_identification) and not self.account_peppol_migration_key: raise UserError( _("A participant with these details has already been registered on the network. "