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 3301079d921..ff8f521509d 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 @@ -816,6 +816,13 @@ msgstr "" msgid "The VAT of the %s should be prefixed with its country code." msgstr "" +#. module: account_edi_ubl_cii +#. odoo-python +#: code:addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py:0 +#, python-format +msgid "The country is required for the %s." +msgstr "" + #. module: account_edi_ubl_cii #. odoo-python #: code:addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py:0 diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py index 6b563c2299a..868adda38e3 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py @@ -578,8 +578,7 @@ class AccountEdiXmlUBL20(models.AbstractModel): constraints = self._invoice_constraints_common(invoice) constraints.update({ 'ubl20_supplier_name_required': self._check_required_fields(vals['supplier'], 'name'), - 'ubl20_customer_name_required': self._check_required_fields(vals['customer'], 'name'), - 'ubl20_commercial_customer_name_required': self._check_required_fields(vals['customer'].commercial_partner_id, 'name'), + 'ubl20_customer_name_required': self._check_required_fields(vals['customer'].commercial_partner_id, 'name'), 'ubl20_invoice_name_required': self._check_required_fields(invoice, 'name'), 'ubl20_invoice_date_required': self._check_required_fields(invoice, 'invoice_date'), }) diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py index ff8de671ef8..b0bc82cd5da 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py @@ -335,7 +335,11 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel): constraints.update({'cen_en16931_tax_line': _("Each invoice line shall have one and only one tax.")}) for role in ('supplier', 'customer'): - constraints[f'cen_en16931_{role}_country'] = self._check_required_fields(vals[role], 'country_id') + constraints[f'cen_en16931_{role}_country'] = self._check_required_fields( + vals['vals'][f'accounting_{role}_party_vals']['party_vals']['postal_address_vals']['country_vals'], + 'identification_code', + _("The country is required for the %s.", role) + ) scheme_vals = vals['vals'][f'accounting_{role}_party_vals']['party_vals']['party_tax_scheme_vals'][-1:] if ( not (scheme_vals and scheme_vals[0]['company_id'] and scheme_vals[0]['company_id'][:2].isalpha()) @@ -405,7 +409,7 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel): 'nl_r_005': _( "%s should have a KVK or OIN number: the Peppol e-address (EAS) should be '0106' or '0190'.", vals['customer'].display_name - ) if vals['customer'].peppol_eas not in ('0106', '0190') else '', + ) if vals['customer'].commercial_partner_id.peppol_eas not in ('0106', '0190') else '', }) if vals['supplier'].country_id.code == 'NO': diff --git a/addons/l10n_dk_oioubl/models/account_edi_xml_oioubl_201.py b/addons/l10n_dk_oioubl/models/account_edi_xml_oioubl_201.py index 60571916ce9..7d9bfd70f97 100644 --- a/addons/l10n_dk_oioubl/models/account_edi_xml_oioubl_201.py +++ b/addons/l10n_dk_oioubl/models/account_edi_xml_oioubl_201.py @@ -271,11 +271,11 @@ class AccountEdiXmlOIOUBL201(models.AbstractModel): building_number = tools.street_split(partner.street).get('street_number') if not building_number: constraints[f"oioubl201_{partner_type}_building_number_required"] = \ - _("The following partner's street number is missing: %s", partner.name) - if partner.country_code == "FR" and not partner.company_registry: + _("The following partner's street number is missing: %s", partner.display_name) + if partner.country_code == "FR" and not partner.commercial_partner_id.company_registry: constraints["oioubl201_company_registry_required_for_french_partner"] = \ - _("The company registry is required for french partner: %s", partner.name) - constraints[f'oioubl201_{partner_type}_vat_required'] = self._check_required_fields(vals[partner_type], 'vat') + _("The company registry is required for french partner: %s", partner.display_name) + constraints[f'oioubl201_{partner_type}_vat_required'] = self._check_required_fields(partner.commercial_partner_id, 'vat') return constraints diff --git a/addons/l10n_ro_edi/models/account_edi_xml_ubl_ciusro.py b/addons/l10n_ro_edi/models/account_edi_xml_ubl_ciusro.py index e3d94cb2c64..ec4f4b0c992 100644 --- a/addons/l10n_ro_edi/models/account_edi_xml_ubl_ciusro.py +++ b/addons/l10n_ro_edi/models/account_edi_xml_ubl_ciusro.py @@ -97,11 +97,11 @@ class AccountEdiXmlUBLRO(models.AbstractModel): f"ciusro_{partner_type}_state_id_required": self._check_required_fields(partner, 'state_id'), }) - if not partner.vat and not partner.company_registry: + if not partner.commercial_partner_id.vat and not partner.commercial_partner_id.company_registry: constraints[f"ciusro_{partner_type}_tax_identifier_required"] = _( "The following partner doesn't have a VAT nor Company ID: %s. " "At least one of them is required. ", - partner.name) + partner.display_name) if (partner.country_code == 'RO' and partner.state_id @@ -111,6 +111,6 @@ class AccountEdiXmlUBLRO(models.AbstractModel): "The following partner's city name is invalid: %s. " "If partner's state is București, the city name must be 'SECTORX', " "where X is a number between 1-6.", - partner.name) + partner.display_name) return constraints