From 80db9716d3b868b7b27d9d0c3fdfb17e5c5f2b04 Mon Sep 17 00:00:00 2001 From: "Thomas Becquevort (thbe)" Date: Wed, 13 Dec 2023 08:44:57 +0000 Subject: [PATCH] [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) Signed-off-by: Thomas Becquevort (thbe) --- addons/base_vat/models/res_partner.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/base_vat/models/res_partner.py b/addons/base_vat/models/res_partner.py index 94d9f49912a..83372484440 100644 --- a/addons/base_vat/models/res_partner.py +++ b/addons/base_vat/models/res_partner.py @@ -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:]