[FIX] l10n_it_edi : invoice template node order

The RappresentanteFiscale and CessionarioCommittente nodes must be in this order in the invoice xml. The RappresentanteFiscale node is only added if the company has a tax representative configured. In that case, before this fix, submitting an invoice to the SDI (Italian tax agency) would not go through and generate an error :
The invoice has been refused by the Exchange System
File non conforme al formato : Invalid content was found starting with element 'RappresentanteFiscale'. One of '{TerzoIntermediarioOSoggettoEmittente, SoggettoEmittente}' is expected.

How to reproduce :
- Install l10n_it_edi_sdicoop
- Configure a tax representative on the company
- Go to accounting settings > Electronic Document Invoicing and choose the test mode + check the “Allow odoo…” checkbox.
- Create a new invoice and confirm
- Click on “Send now”
- Click again on “Send now” until there is an update and the error is displayed.

closes odoo/odoo#100264

Task: opw-2952098
X-original-commit: 71da80deb044852a2af6b111d695f94aad7803ac
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
This commit is contained in:
jbw-odoo
2022-09-15 19:21:28 +02:00
parent e851bbdb29
commit 1b8b1633cc
+18 -18
View File
@@ -79,6 +79,24 @@
<StatoLiquidazione t-esc="company.l10n_it_eco_index_liquidation_state"/>
</IscrizioneREA>
</CedentePrestatore>
<RappresentanteFiscale t-if="not is_self_invoice and representative">
<DatiAnagrafici>
<IdFiscaleIVA>
<IdPaese t-esc="get_vat_country(representative.vat)"/>
<IdCodice t-esc="get_vat_number(representative.vat)"/>
</IdFiscaleIVA>
<CodiceFiscale t-if="representative.l10n_it_codice_fiscale" t-esc="normalize_codice_fiscale(representative.l10n_it_codice_fiscale)"/>
<Anagrafica>
<t t-if="representative.is_company">
<Denominazione t-esc="format_alphanumeric(representative.display_name[:80])"/>
</t>
<t t-else="">
<Nome t-esc="format_alphanumeric(' '.join(representative.name.split()[:1])[:60])"/>
<Cognome t-esc="format_alphanumeric(' '.join(representative.name.split()[1:])[:60])"/>
</t>
</Anagrafica>
</DatiAnagrafici>
</RappresentanteFiscale>
<CessionarioCommittente>
<DatiAnagrafici>
<IdFiscaleIVA t-if="buyer.vat and in_eu(buyer)">
@@ -109,24 +127,6 @@
<t t-set="partner" t-value="buyer_partner"/>
</t>
</CessionarioCommittente>
<RappresentanteFiscale t-if="not is_self_invoice and representative">
<DatiAnagrafici>
<IdFiscaleIVA>
<IdPaese t-esc="get_vat_country(representative.vat)"/>
<IdCodice t-esc="get_vat_number(representative.vat)"/>
</IdFiscaleIVA>
<CodiceFiscale t-if="representative.l10n_it_codice_fiscale" t-esc="normalize_codice_fiscale(representative.l10n_it_codice_fiscale)"/>
<Anagrafica>
<t t-if="representative.is_company">
<Denominazione t-esc="format_alphanumeric(representative.display_name[:80])"/>
</t>
<t t-else="">
<Nome t-esc="format_alphanumeric(' '.join(representative.name.split()[:1])[:60])"/>
<Cognome t-esc="format_alphanumeric(' '.join(representative.name.split()[1:])[:60])"/>
</t>
</Anagrafica>
</DatiAnagrafici>
</RappresentanteFiscale>
</FatturaElettronicaHeader>
<FatturaElettronicaBody>
<DatiGenerali>