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 6da196e6b47..6108a305ed2 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_common.py +++ b/addons/account_edi_ubl_cii/models/account_edi_common.py @@ -74,7 +74,9 @@ COUNTRY_EAS = { 'VA': 9953, 'SE': 9955, 'FR': 9957, - 'NO':'0192', + 'NO': '0192', + 'SG': '0195', + 'AU': '0151', } @@ -172,7 +174,11 @@ class AccountEdiCommon(models.AbstractModel): tax_exemption_reason_code='VATEX-EU-IC', tax_exemption_reason=_('Intra-Community supply'), ) - return create_dict() + + if tax.amount != 0: + return create_dict(tax_category_code='S') + else: + return create_dict(tax_category_code='E', tax_exemption_reason=_('Articles 226 items 11 to 15 Directive 2006/112/EN')) def _get_tax_category_list(self, invoice, taxes): """ Full list: https://unece.org/fileadmin/DAM/trade/untdid/d16b/tred/tred5305.htm 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 58e3c642fe6..6b3fa75661a 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 @@ -54,6 +54,11 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel): vals.pop('registration_name', None) vals.pop('registration_address_vals', None) + # /!\ For Australian companies, the ABN is encoded on the VAT field, but doesn't have the 2 digits prefix, + # causing a validation error + if partner.country_id.code == "AU" and partner.vat and not partner.vat.upper().startswith("AU"): + vals['company_id'] = "AU" + partner.vat + # sources: # https://anskaffelser.dev/postaward/g3/spec/current/billing-3.0/norway/#_applying_foretaksregisteret # https://docs.peppol.eu/poacc/billing/3.0/bis/#national_rules (NO-R-002 (warning)) @@ -117,6 +122,11 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel): 'endpoint_id': partner.l10n_nl_kvk, 'endpoint_id_attrs': {'schemeID': '0106'}, }) + if partner.country_id.code == 'SG' and 'l10n_sg_unique_entity_number' in partner._fields: + vals.update({ + 'endpoint_id': partner.l10n_sg_unique_entity_number, + 'endpoint_id_attrs': {'schemeID': '0195'}, + }) return vals