[FIX] l10n_id: adapt the check to the new VAT regulation

The issue:
Currently, in Indonesia, the regulation for tax ID is 15 digits.
But a new regulation is coming where Tax ID is now 16 digits by adding 0 in front

The fix:
Remove the first zero and leave the rest for the _run_vat_test function

Related PR: #146111

opw-3782636

closes odoo/odoo#157885

Signed-off-by: Quentin De Paoli <qdp@odoo.com>
This commit is contained in:
AMZIL Ayoub
2024-04-26 17:17:51 +00:00
parent ffcf2ee1a3
commit 695ff395cd
+1 -1
View File
@@ -769,7 +769,7 @@ class ResPartner(models.Model):
# VAT is only digits and of the right length, check the Luhn checksum.
try:
luhn.validate(vat[0:9])
luhn.validate(vat[0:9] if len(vat) == 15 else vat[1:10])
except (InvalidFormat, InvalidChecksum):
return False