[FIX] Check if the iban key is present and has a value in the dictionary
authorStephane Wirtel <stephane@tinyerp.com>
Tue, 3 Feb 2009 10:50:03 +0000 (11:50 +0100)
committerStephane Wirtel <stephane@tinyerp.com>
Tue, 3 Feb 2009 10:50:03 +0000 (11:50 +0100)
lp bug: https://launchpad.net/bugs/323238 fixed

bzr revid: stephane@tinyerp.com-20090203105003-4ix3ct06qj93xeux

addons/base_iban/base_iban.py

index aebaa94..2d91e1d 100644 (file)
@@ -38,13 +38,13 @@ class res_partner_bank(osv.osv):
 
     def create(self, cr, uid, vals, context={}):
         #overwrite to format the iban number correctly
-        if vals.has_key('iban'):
+        if 'iban' in vals and vals['iban']:
             vals['iban'] = _format_iban(vals['iban'])
         return super(res_partner_bank, self).create(cr, uid, vals, context)
 
     def write(self, cr, uid, ids, vals, context={}):
         #overwrite to format the iban number correctly
-        if vals.has_key('iban'):
+        if 'iban' in vals and vals['iban']:
             vals['iban'] = _format_iban(vals['iban'])
         return super(res_partner_bank, self).write(cr, uid, ids, vals, context)