[FIX] base_vat: improved code to check whether a method for validation of VAT exists or not

bzr revid: mtr@mtr-20110429115710-xz3atlzuslg0f96h
This commit is contained in:
mtr
2011-04-29 17:27:10 +05:30
parent 8558085634
commit 2b89edcbd0
+1 -2
View File
@@ -63,12 +63,11 @@ class res_partner(osv.osv):
if not partner.vat:
continue
vat_country, vat_number = self._split_vat(partner.vat)
if not _ref_vat.has_key(vat_country):
if not hasattr(self, 'check_vat_' + vat_country):
country_code = vat_country.upper()
code = self.pool.get('res.country').search(cr, uid, [('code', '=', country_code)])
if code:
continue
if not hasattr(self, 'check_vat_' + vat_country):
return False
check = getattr(self, 'check_vat_' + vat_country)
if not check(vat_number):