[FIX] base_vat:code optimization
bzr revid: mtr@mtr-20110429133204-981m1vi624jrj9ob
This commit is contained in:
parent
2b89edcbd0
commit
60bc21cf07
|
@ -59,14 +59,13 @@ class res_partner(osv.osv):
|
||||||
Check the VAT number depending of the country.
|
Check the VAT number depending of the country.
|
||||||
http://sima-pc.com/nif.php
|
http://sima-pc.com/nif.php
|
||||||
'''
|
'''
|
||||||
|
country_obj = self.pool.get('res.country')
|
||||||
for partner in self.browse(cr, uid, ids, context=context):
|
for partner in self.browse(cr, uid, ids, context=context):
|
||||||
if not partner.vat:
|
if not partner.vat:
|
||||||
continue
|
continue
|
||||||
vat_country, vat_number = self._split_vat(partner.vat)
|
vat_country, vat_number = self._split_vat(partner.vat)
|
||||||
if not hasattr(self, 'check_vat_' + vat_country):
|
if not hasattr(self, 'check_vat_' + vat_country):
|
||||||
country_code = vat_country.upper()
|
if country_obj.search(cr, uid, [('code', 'ilike', vat_country)], context=context):
|
||||||
code = self.pool.get('res.country').search(cr, uid, [('code', '=', country_code)])
|
|
||||||
if code:
|
|
||||||
continue
|
continue
|
||||||
return False
|
return False
|
||||||
check = getattr(self, 'check_vat_' + vat_country)
|
check = getattr(self, 'check_vat_' + vat_country)
|
||||||
|
|
Loading…
Reference in New Issue