check vat: handle the case of an unknow country code
bzr revid: christophe@tinyerp.com-20080826143201-vfxsg7hvkrsly83h
This commit is contained in:
parent
51c6c66a7c
commit
b93adda14d
|
@ -28,7 +28,7 @@
|
|||
###############################################################################
|
||||
{
|
||||
"name" : "VAT",
|
||||
"description": "Enable the VAT Number for the partner. Check the validity of that VAT Number (idea and code from Tryton (B2CK)).",
|
||||
"description": "Enable the VAT Number for the partner. Check the validity of that VAT Number.",
|
||||
"version" : "1.0",
|
||||
"author" : "Tiny",
|
||||
"category" : "Generic Modules/Base",
|
||||
|
|
|
@ -51,7 +51,9 @@ class res_partner(osv.osv):
|
|||
continue #FIXME return False? empty vat numbre is invalid?
|
||||
|
||||
vat_country, vat_number = partner.vat[:2].lower(), partner.vat[2:]
|
||||
if not getattr(self, 'check_vat_' + vat_country)(vat_number):
|
||||
|
||||
check = getattr(self, 'check_vat_' + vat_country, lambda vn: False)
|
||||
if not check(vat_number):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue