Browse Source

Merge pull request #125 from steveferry/7.0

Keep partner's lastname if it has one
pull/157/head
Pedro M. Baeza 10 years ago
parent
commit
701ef98425
  1. 6
      partner_firstname/res_user.py

6
partner_firstname/res_user.py

@ -35,8 +35,14 @@ class ResUsers(orm.Model):
installed
"""
vals2 = vals.copy()
if 'name' in vals:
vals2['lastname'] = vals2['name']
elif 'lastname' not in vals and 'partner_id' in vals:
res_partner = self.pool.get('res.partner')
partner = res_partner.browse(cr, user, vals2['partner_id'],
context)
vals2['lastname'] = partner.lastname
elif 'login' in vals and 'lastname' not in vals:
vals2['lastname'] = vals2['login']
return super(ResUsers, self).create(cr, user, vals2, context=context)

Loading…
Cancel
Save