diff --git a/addons/base_vat/models/res_partner.py b/addons/base_vat/models/res_partner.py index af0f09ac077..c6dc7d5cd19 100644 --- a/addons/base_vat/models/res_partner.py +++ b/addons/base_vat/models/res_partner.py @@ -69,7 +69,12 @@ _ref_vat = { 'si': 'SI12345679', 'sk': 'SK2022749619', 'sm': 'SM24165', - 'tr': 'TR1234567890 (VERGINO) or TR17291716060 (TCKIMLIKNO)' # Levent Karakas @ Eska Yazilim A.S. + 'tr': 'TR1234567890 (VERGINO) or TR17291716060 (TCKIMLIKNO)', # Levent Karakas @ Eska Yazilim A.S. + 'xi': 'XI123456782', +} + +_region_specific_vat_codes = { + 'xi', } @@ -179,8 +184,10 @@ class ResPartner(models.Model): # First check with country code as prefix of the TIN vat_country_code, vat_number_split = self._split_vat(vat_number) - vat_guessed_country = self.env['res.country'].search([('code', '=', vat_country_code.upper())]) - if vat_guessed_country: + vat_has_legit_country_code = self.env['res.country'].search([('code', '=', vat_country_code.upper())]) + if not vat_has_legit_country_code: + vat_has_legit_country_code = vat_country_code.lower() in _region_specific_vat_codes + if vat_has_legit_country_code: check_result = check_func(vat_country_code, vat_number_split) if check_result: return vat_country_code