[IMP] base: 15 or 16 digits for ID VAT Number

Description of the issue/feature this commit addresses:

On the first of Janurary 2024, Indonesia will use 16 digits VAT numbers in
addition to 15 digits ones. This commit makes it possible to use any of these
two possibilites when entering the VAT number on an indonesian company.

Desired behavior after this commit is merged:

This commit makes it possible to enter either a 15 or 16 digit VAT Number on
an Indonesian company.

task-3636748

closes odoo/odoo#147215

X-original-commit: aae3495334f02eaf43e0396b040b75c926406fbd
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
Signed-off-by: Thomas Becquevort (thbe) <thbe@odoo.com>
This commit is contained in:
Thomas Becquevort (thbe)
2023-12-21 23:54:42 +00:00
parent 9ac153c7aa
commit 80db9716d3
+7
View File
@@ -738,6 +738,13 @@ class ResPartner(models.Model):
stdnum_vat_format = getattr(stdnum.util.get_cc_module('ch', 'vat'), 'format', None)
return stdnum_vat_format('CH' + vat)[2:] if stdnum_vat_format else vat
def check_vat_id(self, vat):
""" Temporary Indonesian VAT validation to support the new format
introduced in January 2024."""
if len(vat) in (15, 16) and vat[0:15].isdigit() and vat[-1].isdigit():
return True
return False
def format_vat_sm(self, vat):
stdnum_vat_format = stdnum.util.get_cc_module('sm', 'vat').compact
return stdnum_vat_format('SM' + vat)[2:]