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 31189c578fd..613f129edf3 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 @@ -49,6 +49,9 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel): # EXTENDS account.edi.xml.ubl_21 vals_list = super()._get_partner_party_tax_scheme_vals_list(partner, role) + if not partner.vat: + return [] + for vals in vals_list: vals.pop('registration_name', None) vals.pop('registration_address_vals', None) diff --git a/addons/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_public_admin.xml b/addons/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_public_admin.xml new file mode 100644 index 00000000000..80bc38719bd --- /dev/null +++ b/addons/l10n_account_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_public_admin.xml @@ -0,0 +1,134 @@ + + + urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 + urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 + INV/2017/00001 + 2017-01-01 + 2017-02-28 + 380 + test narration + USD + ref_partner_2 + + ref_move + + + ___ignore___ + + ___ignore___ + + + + + BE0202239951 + + partner_1 + + + Chaussée de Namur 40 + Ramillies + 1367 + + BE + + + + BE0202239951 + + VAT + + + + partner_1 + BE0202239951 + + + partner_1 + + + + + + 00005000041 + + partner_2 + + + Rue des Bourlottes 9 + Ramillies + 1367 + + BE + + + + partner_2 + + + partner_2 + + + + + + + Rue des Bourlottes 9 + Ramillies + 1367 + + BE + + + + + + 30 + +++000/0000/05959+++ + + BE15001559627230 + + + + 30% Advance End of Following Month + + + 42.00 + + 200.00 + 42.00 + + S + 21.0 + + VAT + + + + + + 200.00 + 200.00 + 242.00 + 0.00 + 242.00 + + + 234 + 2.0 + 200.00 + + product_a + product_a + + S + 21.0 + + VAT + + + + + 100.00 + + + diff --git a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py index 3f027961e4c..15023276149 100644 --- a/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py +++ b/addons/l10n_account_edi_ubl_cii_tests/tests/test_xml_ubl_be.py @@ -206,6 +206,49 @@ class TestUBLBE(TestUBLCommon): ) self._test_encoding_in_attachment(invoice.ubl_cii_xml_id, 'ubl_bis3.xml') + def test_sending_to_public_admin(self): + """ A public administration has no VAT, but has an arbitrary number (see: + https://pch.gouvernement.lu/fr/peppol.html). When a partner has no VAT, the node PartyTaxScheme should + not appear. In addition, the `EndpointID` node should be filled with this arbitrary number (use the field + `peppol_endpoint`). + """ + # Setup a public admin in Luxembourg + self.partner_2.update({ + 'vat': None, + 'peppol_endpoint': '00005000041', + 'peppol_eas': '9938', + }) + + invoice = self._generate_move( + self.partner_1, + self.partner_2, + move_type='out_invoice', + invoice_line_ids=[ + { + 'product_id': self.product_a.id, + 'quantity': 2, + 'price_unit': 100, + 'tax_ids': [(6, 0, self.tax_21.ids)], + } + ], + ) + self._assert_invoice_attachment( + invoice.ubl_cii_xml_id, + xpaths=f''' + + ___ignore___ + + + ___ignore___ + + + application/pdf + {invoice.invoice_pdf_report_id.name} + + ''', + expected_file='from_odoo/bis3_out_invoice_public_admin.xml', + ) + #################################################### # Test import ####################################################