diff --git a/addons/l10n_it_edi/data/invoice_it_template.xml b/addons/l10n_it_edi/data/invoice_it_template.xml
index f129bb156792ff0940fec9aeaa24f0e8732315b9..64b9ae0525fa5baba0e6c786efe6e2e8c5509d86 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 e6b23f8953c7b6f073582e7e92518ad4cbf7525f..1c37db16e156ab6d4a8dd4ed3f461833a753a24d 100644
--- a/addons/l10n_it_edi/models/account_edi_format.py
+++ b/addons/l10n_it_edi/models/account_edi_format.py
@@ -96,9 +96,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>