Skip to content
Snippets Groups Projects
Commit 5cd4df74 authored by Katherine Zaoral's avatar Katherine Zaoral
Browse files

[IMP] l10n_ar:_sanitize vat number method


* fix traceback when vat is not defined, return directly 0.
* remove api.model
* add ensure_one() to avoid misuse of the method

closes odoo/odoo#84760

Related: odoo/enterprise#23977
Signed-off-by: default avatarJosse Colpaert <jco@odoo.com>
parent b680d8b2
Branches
Tags
No related merge requests found
......@@ -112,9 +112,12 @@ class ResPartner(models.Model):
except Exception as error:
raise ValidationError(repr(error))
@api.model
def _get_id_number_sanitize(self):
""" Sanitize the identification number. Return the digits/integer value of the identification number """
""" Sanitize the identification number. Return the digits/integer value of the identification number
If not vat number defined return 0 """
self.ensure_one()
if not self.vat:
return 0
if self.l10n_latam_identification_type_id.l10n_ar_afip_code in ['80', '86']:
# Compact is the number clean up, remove all separators leave only digits
res = int(stdnum.ar.cuit.compact(self.vat))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment