[FIX] account_edi_ubl_cii: fix for NZ partners - GLN instead of vat

For the A-NZ UBL 1.0.8 format, when selecting NZ partners, the elements
in `/cac:Party/cbc:EndpointID` and
`/cac:Party/cac:PartyLegalEntity/cbc:CompanyID` should be the GLN: the
Global Location Number (the corresponding EAS is 0088). The GLN is the
`company_registry` for NZ partners.

Before this fix, the VAT was filled for both elements and it raised a
"GLN must have a valid format according to GS1 rules." error on Ecosio.

closes odoo/odoo#112983

X-original-commit: 2e2ff2813de8b5c1f272eb84319170e07d19154e
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
Signed-off-by: Julien Van Roy <juvr@odoo.com>
This commit is contained in:
Julien Van Roy
2023-02-17 13:06:59 +01:00
parent 85c0f12c88
commit 5a5a00a352
@@ -21,8 +21,8 @@ class AccountEdiXmlUBLANZ(models.AbstractModel):
def _export_invoice_ecosio_schematrons(self):
return {
'invoice': 'eu.peppol.bis3.aunz.ubl:invoice:1.0.7',
'credit_note': 'eu.peppol.bis3.aunz.ubl:creditnote:1.0.7',
'invoice': 'eu.peppol.bis3.aunz.ubl:invoice:1.0.8',
'credit_note': 'eu.peppol.bis3.aunz.ubl:creditnote:1.0.8',
}
def _get_partner_party_tax_scheme_vals_list(self, partner, role):
@@ -41,6 +41,8 @@ class AccountEdiXmlUBLANZ(models.AbstractModel):
if partner.country_code == 'AU':
vals['endpoint_id'] = partner.vat.replace(" ", "")
if partner.country_code == 'NZ':
vals['endpoint_id'] = partner.company_registry
for party_tax_scheme in vals['party_tax_scheme_vals']:
party_tax_scheme['tax_scheme_id'] = 'GST'
@@ -58,7 +60,10 @@ class AccountEdiXmlUBLANZ(models.AbstractModel):
'company_id_attrs': {'schemeID': '0151'},
})
if partner.country_code == 'NZ':
vals['company_id_attrs'] = {'schemeID': '0088'}
vals.update({
'company_id': partner.company_registry,
'company_id_attrs': {'schemeID': '0088'},
})
return vals_list
def _get_tax_category_list(self, invoice, taxes):