[FIX] l10n_it_edi: fix buyers' codice fiscale in the template

Just like the seller's codice fiscale is always shown in the FatturaPA
XML if present on the partner, so should be the one from the buyer.

If it's not, then when a company is a part of a fiscal group sharing
the same VAT number and different Tax Codes, the SDI will reject the
XML because the VAT number won't be enough for the Tax Agency
to identify the company.

There is no damage in showing the Codice Fiscale when the VAT is also
there.

opw-3114115

closes odoo/odoo#110307

X-original-commit: db5ce853e15b5003771c4811302dbff6e3cc054b
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
This commit is contained in:
Paolo Gatti
2023-01-18 20:04:13 +01:00
parent 6876a19cb9
commit 50f99e3617
5 changed files with 5 additions and 3 deletions
@@ -119,8 +119,7 @@
<IdPaese t-out="buyer.country_id.code"/>
<IdCodice t-out="'0000000'"/>
</IdFiscaleIVA>
<CodiceFiscale t-if="not buyer.vat and buyer.l10n_it_codice_fiscale" t-out="normalize_codice_fiscale(buyer.l10n_it_codice_fiscale)"/>
<CodiceFiscale t-elif="not buyer.vat and not buyer.l10n_it_codice_fiscale" t-out="99999999999"/>
<CodiceFiscale t-if="buyer.l10n_it_codice_fiscale" t-esc="normalize_codice_fiscale(buyer.l10n_it_codice_fiscale)"/>
<Anagrafica>
<t t-if="buyer_is_company">
<Denominazione t-out="format_alphanumeric(buyer.display_name[:80])"/>
+1 -1
View File
@@ -47,7 +47,7 @@ class TestItEdi(AccountEdiTestCommon):
cls.italian_partner_a = cls.env['res.partner'].create({
'name': 'Alessi',
'vat': 'IT00465840031',
'l10n_it_codice_fiscale': '00465840031',
'l10n_it_codice_fiscale': '93026890017',
'country_id': cls.env.ref('base.it').id,
'street': 'Via Privata Alessi 6',
'zip': '28887',
@@ -36,6 +36,7 @@
<IdPaese>IT</IdPaese>
<IdCodice>00465840031</IdCodice>
</IdFiscaleIVA>
<CodiceFiscale>93026890017</CodiceFiscale>
<Anagrafica>
<Denominazione>Alessi</Denominazione>
</Anagrafica>
@@ -35,6 +35,7 @@
<IdPaese>IT</IdPaese>
<IdCodice>01234560157</IdCodice>
</IdFiscaleIVA>
<CodiceFiscale>01234560157</CodiceFiscale>
<Anagrafica>
<Denominazione>company_2_data</Denominazione>
</Anagrafica>
@@ -36,6 +36,7 @@
<IdPaese>IT</IdPaese>
<IdCodice>00465840031</IdCodice>
</IdFiscaleIVA>
<CodiceFiscale>93026890017</CodiceFiscale>
<Anagrafica>
<Denominazione>Alessi</Denominazione>
</Anagrafica>