diff --git a/addons/l10n_it_edi/data/invoice_it_template.xml b/addons/l10n_it_edi/data/invoice_it_template.xml index 4d067c4595461c39ce439874e9a70d046e5bc9cd..25e7c9e53a2989216454107d0e25ecb7a11c34df 100644 --- a/addons/l10n_it_edi/data/invoice_it_template.xml +++ b/addons/l10n_it_edi/data/invoice_it_template.xml @@ -58,10 +58,18 @@ </DatiTrasmissione> <CedentePrestatore> <DatiAnagrafici> - <IdFiscaleIVA> + <IdFiscaleIVA t-if="seller.vat and in_eu(seller)"> <IdPaese t-esc="get_vat_country(seller.vat)"/> <IdCodice t-esc="get_vat_number(seller.vat)"/> </IdFiscaleIVA> + <IdFiscaleIVA t-if="seller.vat and not in_eu(seller)"> + <IdPaese t-esc="seller.country_id.code"/> + <IdCodice t-esc="'OO99999999999'"/> + </IdFiscaleIVA> + <IdFiscaleIVA t-if="not seller.vat and seller.country_id.code != 'IT'"> + <IdPaese t-esc="seller.country_id.code"/> + <IdCodice t-esc="'0000000'"/> + </IdFiscaleIVA> <CodiceFiscale t-if="seller.l10n_it_codice_fiscale" t-esc="normalize_codice_fiscale(seller.l10n_it_codice_fiscale)"/> <Anagrafica> <Denominazione t-esc="format_alphanumeric(seller_partner.display_name[:80])"/> diff --git a/addons/l10n_it_edi/models/account_edi_format.py b/addons/l10n_it_edi/models/account_edi_format.py index 059ab798d349beaa0a16143a7614bef3e92f2a2f..c07b18da2689166445252194fdaa466d63edce8c 100644 --- a/addons/l10n_it_edi/models/account_edi_format.py +++ b/addons/l10n_it_edi/models/account_edi_format.py @@ -88,9 +88,9 @@ class AccountEdiFormat(models.Model): errors.append(_("%s must have a country", seller.display_name)) # <1.1.1.2> - if not seller.vat: + if not invoice.company_id.vat: errors.append(_("%s must have a VAT number", seller.display_name)) - elif len(seller.vat) > 30: + if seller.vat and len(seller.vat) > 30: errors.append(_("The maximum length for VAT number is 30. %s have a VAT number too long: %s.", seller.display_name, seller.vat)) # <1.2.1.2>