summaryrefslogtreecommitdiff
path: root/addons/base_vat
diff options
context:
space:
mode:
authorAndrea Grazioso (agr-odoo) <agr@odoo.com>2021-03-02 10:45:13 +0000
committerAndrea Grazioso (agr-odoo) <agr@odoo.com>2021-03-08 10:28:59 +0000
commit7e7d8731aa5679123100311b573a65ae23f3db99 (patch)
tree9d5af5e55959d8ca6af786c43a4104b0b0556fde /addons/base_vat
parentd3f74845b40870851c8140cac0a5f06510381445 (diff)
[FIX] base_vat: accept XI VAT format
Following Brexit on January 1st 2021, companies in Northern Ireland have a new VAT number starting with XI instead of GB. More info: https://www.gov.uk/government/publications/accounting-for-vat-on-goods-moving-between-great-britain-and-northern-ireland-from-1-january-2021/check-when-you-are-trading-under-the-northern-ireland-protocol-if-you-are-vat-registered-business stdnum support the new XI VAT from 1.16 https://github.com/arthurdejong/python-stdnum/commit/b93d69581f35aa18e7fdd52b3f7fdf06770215e3 This patch add temporary support in base_vat until the new version is available on the Debian package repository Community tracked issue https://github.com/odoo/odoo/issues/64891 opw-2461322 closes odoo/odoo#67402 X-original-commit: 049ea814283448e44e102969ffd08837f110e3ea Signed-off-by: William André (wan) <wan@odoo.com> Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/base_vat')
-rw-r--r--addons/base_vat/models/res_partner.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/base_vat/models/res_partner.py b/addons/base_vat/models/res_partner.py
index dcb863d68a3..2dcbee9d8cb 100644
--- a/addons/base_vat/models/res_partner.py
+++ b/addons/base_vat/models/res_partner.py
@@ -43,7 +43,7 @@ _ref_vat = {
'es': 'ESA12345674',
'fi': 'FI12345671',
'fr': 'FR23334175221',
- 'gb': 'GB123456782',
+ 'gb': 'GB123456782 or XI123456782',
'gr': 'GR12345670',
'hu': 'HU12345676',
'hr': 'HR01234567896', # Croatia, contributed by Milan Tribuson
@@ -472,6 +472,13 @@ class ResPartner(models.Model):
res.append(False)
return all(res)
+ def check_vat_xi(self, vat):
+ """ Temporary Nothern Ireland VAT validation following Brexit
+ As of January 1st 2021, companies in Northern Ireland have a
+ new VAT number starting with XI
+ TODO: remove when stdnum is updated to 1.16 in supported distro"""
+ return stdnum.util.get_cc_module('gb', 'vat').is_valid(vat) if stdnum else True
+
def check_vat_in(self, vat):
#reference from https://www.gstzen.in/a/format-of-a-gst-number-gstin.html
if vat and len(vat) == 15: