Browse Source

[FIX] avoid traceback when calling the fnct_inv method with a null field_value

pull/2/head
Olivier LAURENT 11 years ago
parent
commit
9275c8ca95
  1. 4
      partner_firstname/partner.py

4
partner_firstname/partner.py

@ -53,7 +53,7 @@ class ResPartner(Model):
* otherwise lastname=new name and firstname=False * otherwise lastname=new name and firstname=False
In addition an heuristic avoids to keep a firstname without a non-blank lastname In addition an heuristic avoids to keep a firstname without a non-blank lastname
""" """
field_value = not field_value.isspace() and field_value or False
field_value = field_value and not field_value.isspace() and field_value or False
vals = {'lastname': field_value, 'firstname': False} vals = {'lastname': field_value, 'firstname': False}
if field_value: if field_value:
flds = self.read(cursor, uid, [partner_id], ['firstname', 'is_company'], context=context)[0] flds = self.read(cursor, uid, [partner_id], ['firstname', 'is_company'], context=context)[0]
@ -90,7 +90,7 @@ class ResPartner(Model):
will not install if there is demo data will not install if there is demo data
""" """
to_use = vals to_use = vals
if vals.get('name'):
if 'name' in vals:
corr_vals = vals.copy() corr_vals = vals.copy()
corr_vals['lastname'] = corr_vals['name'] corr_vals['lastname'] = corr_vals['name']
del(corr_vals['name']) del(corr_vals['name'])

Loading…
Cancel
Save