From 459684e2a16601e03215b719755318da30824d5b Mon Sep 17 00:00:00 2001 From: Paolo Gatti Date: Tue, 8 Nov 2022 16:06:24 +0000 Subject: [PATCH] [FIX] l10n_it_edi: Non EU VAT fix Non EU vendor bills are sent to the Tax Agency as self-invoices, so the partner actually is the seller, but the same checks on the VAT must apply as it was the buyer. Task: https://www.odoo.com/web#id=3010849&model=project.task opw-3010849 closes odoo/odoo#106312 X-original-commit: 8c18b870ecc04314380fcdb6b61179de78e28703 Signed-off-by: Josse Colpaert Signed-off-by: Paolo Gatti (pgi) --- addons/l10n_it_edi/data/invoice_it_template.xml | 10 +++++++++- addons/l10n_it_edi/models/account_edi_format.py | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/addons/l10n_it_edi/data/invoice_it_template.xml b/addons/l10n_it_edi/data/invoice_it_template.xml index 226bf683ef1..2582c8b2aad 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 @@ - + + + + + + + + + diff --git a/addons/l10n_it_edi/models/account_edi_format.py b/addons/l10n_it_edi/models/account_edi_format.py index e6b23f8953c..1c37db16e15 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>