[FIX] l10n_ar: properly compute l10n_ar_vat field

Only compute l10n_ar_vat when this one is defined, if not then the field
should not be computed.

closes odoo/odoo#55246

X-original-commit: 4e2de8c858c2d55b227b8a2fd3f8226f9da91a9d
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Katherine Zaoral
2020-07-31 09:10:06 +00:00
parent d24e3e780f
commit c8b2434d61
+1 -1
View File
@@ -50,7 +50,7 @@ class ResPartner(models.Model):
""" We add this computed field that returns cuit (VAT AR) or nothing if this one is not set for the partner.
This Validation can be also done by calling ensure_vat() method that returns the cuit (VAT AR) or error if this
one is not found """
recs_ar_vat = self.filtered(lambda x: x.l10n_latam_identification_type_id.l10n_ar_afip_code == '80')
recs_ar_vat = self.filtered(lambda x: x.l10n_latam_identification_type_id.l10n_ar_afip_code == '80' and x.vat)
for rec in recs_ar_vat:
rec.l10n_ar_vat = stdnum.ar.cuit.compact(rec.vat)
remaining = self - recs_ar_vat