[IMP] base_vat: add New Zealand IRD/GST number validation

closes odoo/odoo#110125

X-original-commit: 8b0bcbb3fc4f14d6706860831c16e37360a2d247
Signed-off-by: Josse Colpaert <jco@odoo.com>
This commit is contained in:
Robert Coleman
2023-01-17 20:59:05 +01:00
parent 9a06c9550a
commit c84618b8bd
+10
View File
@@ -61,6 +61,7 @@ _ref_vat = {
'mx': 'MXGODE561231GR8 or GODE561231GR8',
'nl': 'NL123456782B90',
'no': 'NO123456785',
'nz': '49-098-576 or 49098576',
'pe': '10XXXXXXXXY or 20XXXXXXXXY or 15XXXXXXXXY or 16XXXXXXXXY or 17XXXXXXXXY',
'ph': '123-456-789-01234',
'pl': 'PL1234567883',
@@ -598,6 +599,15 @@ class ResPartner(models.Model):
return len(vat) == 11 and vat.isdigit()
return check_func(vat)
def check_vat_nz(self, vat):
'''
The New Zealand equivalent of a VAT number is an IRD number (GST number is another name for this).
IRD/GST numbers must legally must be displayed on all tax invoices.
https://arthurdejong.org/python-stdnum/doc/1.13/stdnum.nz.ird#module-stdnum.nz.ird
'''
check_func = stdnum.util.get_cc_module('nz', 'ird').is_valid
return check_func(vat)
def format_vat_eu(self, vat):
# Foreign companies that trade with non-enterprises in the EU
# may have a VATIN starting with "EU" instead of a country code.