Skip to content

Commit 49b6bb1

Browse files
committed
[FIX] l10n_fr_facturx_chorus_pro: remove schemeName in BIS3 XML
Issue: BIS3 XML is not valid for Peppol Steps to reproduce: - Install l10n_fr_facturx_chorus_pro and switch to french company - Activate peppol - Create a French customer - Under Sales and Purchase tab, set SIRET to "11000201100044" - Under Accounting tab, set the following: - Invoice sending = Peppol - Einvoice format = BIS Billing 3.0 - peppol_eas = France SIRET - peppol endpoint = 11000201100044 - Use Invoice/Invoiced smart button, then select New to create an invoice for this french customer - Add any non-zero invoice line, then confirm - Send and print, send to peppol - Download the XML. The /PartyIdentification/ID element will have the schemeName attribute set. Cause: Previous [commit](odoo@0f3a9de#diff-10c62c279423109c43458eab15a3177ff5592d6570451f890fead74389bc3740) added `schemeName`. But Peppol doesn't want any `schemeName`, see the [doc](https://docs.peppol.eu/poacc/billing/3.0/rules/ubl-tc434/UBL-DT-08/). Solution: The correct attribute here seems to be `schemeID`. See an [example from the docs of Peppol](https://docs.peppol.eu/poacc/billing/3.0/bis/#_parties_2). Change `schemeName` to `schemeID`. opw-4934436 closes odoo#219586 X-original-commit: c3ae4b2 Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com> Signed-off-by: Mathieu Coutant (mcou) <mcou@odoo.com>
1 parent 469caae commit 49b6bb1

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

addons/l10n_fr_facturx_chorus_pro/models/account_edi_xml_ubl_bis3.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from odoo import models, _
2+
from odoo.addons.account_edi_ubl_cii.models.account_edi_common import EAS_MAPPING
23

34

45
CHORUS_PRO_PEPPOL_ID = "0009:11000201100044"
6+
FR_SCHEME_IDS = {v: k for k, v in EAS_MAPPING['FR'].items()}
57

68

79
class AccountEdiXmlUbl_Bis3(models.AbstractModel):
@@ -35,12 +37,12 @@ def _export_invoice_vals(self, invoice):
3537
if partner.company_registry and partner.country_code == 'FR':
3638
vals['vals'][f'accounting_{role}_party_vals']['party_vals']['party_identification_vals'] = [{
3739
'id': partner.company_registry,
38-
'id_attrs': {'schemeName': 1},
40+
'id_attrs': {'schemeID': FR_SCHEME_IDS['company_registry']},
3941
}]
4042
else:
4143
vals['vals'][f'accounting_{role}_party_vals']['party_vals']['party_identification_vals'] = [{
4244
'id': partner.vat,
43-
'id_attrs': {'schemeName': 2},
45+
'id_attrs': {'schemeID': FR_SCHEME_IDS['vat']},
4446
}]
4547
return vals
4648

@@ -95,8 +97,8 @@ def _get_party_node(self, vals):
9597
if partner.company_registry and partner.country_code == 'FR'
9698
else partner.vat
9799
),
98-
'schemeName': (
99-
'1' if partner.company_registry and partner.country_code == 'FR' else '2'
100+
'schemeID': (
101+
FR_SCHEME_IDS['company_registry'] if partner.company_registry and partner.country_code == 'FR' else FR_SCHEME_IDS['vat']
100102
),
101103
}
102104
}

addons/l10n_fr_facturx_chorus_pro/tests/test_chorus_pro_xml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ def test_export_invoice_chorus_pro(self):
5050

5151
supplier_identification_node = xml_etree.find("{*}AccountingSupplierParty/{*}Party/{*}PartyIdentification/{*}ID")
5252
self.assertEqual(supplier_identification_node.text, "02546465000024")
53-
self.assertEqual(supplier_identification_node.attrib, {'schemeName': '1'})
53+
self.assertEqual(supplier_identification_node.attrib, {'schemeID': '0009'})
5454

5555
customer_identification_node = xml_etree.find("{*}AccountingCustomerParty/{*}Party/{*}PartyIdentification/{*}ID")
5656
self.assertEqual(customer_identification_node.text, "21440109300015")
57-
self.assertEqual(customer_identification_node.attrib, {'schemeName': '1'})
57+
self.assertEqual(customer_identification_node.attrib, {'schemeID': '0009'})
5858

5959
self.assertEqual(xml_etree.findtext("{*}BuyerReference"), "buyer_ref_123")
6060
self.assertEqual(xml_etree.findtext("{*}OrderReference/{*}ID"), "order_ref_123")

0 commit comments

Comments
 (0)