From 5a5a00a3528e51d986eb62d619c2eea13df575ca Mon Sep 17 00:00:00 2001 From: Julien Van Roy Date: Fri, 10 Feb 2023 14:30:03 +0000 Subject: [PATCH] [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) Signed-off-by: Julien Van Roy --- .../models/account_edi_xml_ubl_a_nz.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_a_nz.py b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_a_nz.py index 56c6de88bfe..82bf7daa372 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_a_nz.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_a_nz.py @@ -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):