[FIX] l10n_it_edi: Relax zip check for non-Italian buyers.

With Italian localization, the length of zip must be 5 for Italian buyer.
If the buyer is not Italian, we doesn't check his zip length.

closes odoo/odoo#31205
This commit is contained in:
jbm-odoo
2019-02-18 15:28:23 +00:00
parent 9ba75cd7f4
commit 8a4fe6d756
+1 -1
View File
@@ -112,7 +112,7 @@ class AccountInvoice(models.Model):
raise UserError(_("%s must have a street.") % (buyer.display_name))
if not buyer.zip:
raise UserError(_("%s must have a post code.") % (buyer.display_name))
if len(buyer.zip) != 5:
if len(buyer.zip) != 5 and buyer.country_id.code == 'IT':
raise UserError(_("%s must have a post code of length 5.") % (buyer.display_name))
if not buyer.city:
raise UserError(_("%s must have a city.") % (buyer.display_name))