Browse Source

[FIX] partner_firstname - error when lastname being empty with demo data, migrated data or imported data

pull/2/head
Yannick Vaucher 11 years ago
parent
commit
8c30f6e866
  1. 7
      partner_firstname/partner.py

7
partner_firstname/partner.py

@ -33,9 +33,10 @@ class ResPartner(Model):
def _compute_name_custom(self, cursor, uid, ids, fname, arg, context=None): def _compute_name_custom(self, cursor, uid, ids, fname, arg, context=None):
res = {} res = {}
for rec in self.read(cursor, uid, ids, ['firstname', 'lastname']): for rec in self.read(cursor, uid, ids, ['firstname', 'lastname']):
name = '%s %s'%(rec['lastname'] if rec['lastname'] else u"",
rec['firstname'] if rec['firstname'] else u"")
res[rec['id']] = name
names = [rec['lastname'],
rec['firstname']]
fullname = " ".join([s for s in names if s])
res[rec['id']] = fullname
return res return res
def _write_name(self, cursor, uid, partner_id, field_name, field_value, arg, context=None): def _write_name(self, cursor, uid, partner_id, field_name, field_value, arg, context=None):

Loading…
Cancel
Save