Skip to content

Commit

Permalink
[IMP] base: 15 or 16 digits for ID VAT Number
Browse files Browse the repository at this point in the history
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#147215

X-original-commit: aae3495
Signed-off-by: Nicolas Viseur (vin) <[email protected]>
Signed-off-by: Thomas Becquevort (thbe) <[email protected]>
  • Loading branch information
Megaaaaaa committed Dec 21, 2023
1 parent 9ac153c commit 80db971
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/base_vat/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,13 @@ def format_vat_ch(self, vat):
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:]
Expand Down

0 comments on commit 80db971

Please sign in to comment.