Browse Source

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

pull/487/head
Yannick Vaucher 12 years ago
committed by Enric Tobella
parent
commit
af80ae43ef
  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