[FIX] base_vat: vat check for EU TIN.

Foreign companies that trade with non-enterprises in the EU
may have a VATIN starting with "EU" instead of a country code.

See
 - http://en.wikipedia.org/wiki/VAT_identification_number
 - http://www.becompta.be/forums/tva/ndeg-tva-commencant-eu
 - http://www.bruynfico.be/index.php/7-droit-comptable/19-connexion-asp?idart=159

opw-621177
This commit is contained in:
Denis Ledoux 2015-02-02 16:44:43 +01:00
parent 05c907b60b
commit e999f4c100
1 changed files with 4 additions and 0 deletions

View File

@ -91,6 +91,10 @@ class res_partner(osv.osv):
getattr(vatnumber, check_func_name, None)
if not check_func:
# No VAT validation available, default to check that the country code exists
if country_code.upper() == 'EU':
# Foreign companies that trade with non-enterprises in the EU
# may have a VATIN starting with "EU" instead of a country code.
return True
res_country = self.pool.get('res.country')
return bool(res_country.search(cr, uid, [('code', '=ilike', country_code)], context=context))
return check_func(vat_number)