[IMP]GOLEM Family : sets lastname to family name onchange if there was no one given

This commit is contained in:
Fabien Bourgeois 2016-07-13 20:11:56 +02:00
parent d987561be9
commit 5fc0b7421a

View File

@ -40,6 +40,13 @@ class ResPartner(models.Model):
class GolemMember(models.Model): class GolemMember(models.Model):
_inherit = 'golem.member' _inherit = 'golem.member'
@api.onchange('family_id')
def onchange_family(self):
""" Sets lastname as family name if there was no precedence """
for p in self:
if not p.lastname:
p.lastname = self.family_id.name
@api.multi @api.multi
def button_family_members(self): def button_family_members(self):
self.ensure_one() self.ensure_one()