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. "