[FIX] l10n_it_edi: fixed zip code check for the buyer

If the buyer is Italian, it must have a zip code of length 5.
If the buyer is not Italian, the zip code is optional

closes odoo/odoo#73883

X-original-commit: 86aa7507b0d86bd13dba303c75821048d420f647
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
This commit is contained in:
Benjamin Frantzen (bfr)
2021-07-16 13:32:30 +00:00
parent 19d577c64e
commit b3e9da31a1
@@ -90,7 +90,7 @@ class AccountEdiFormat(models.Model):
errors.append(_("%s must have a street.", buyer.display_name))
if not buyer.zip:
errors.append(_("%s must have a post code.", buyer.display_name))
if len(buyer.zip) != 5 and buyer.country_id.code == 'IT':
elif len(buyer.zip) != 5 and buyer.country_id.code == 'IT':
errors.append(_("%s must have a post code of length 5.", buyer.display_name))
if not buyer.city:
errors.append(_("%s must have a city.", buyer.display_name))