forked from Yaltik/golem
Small refactorings
This commit is contained in:
parent
66b851692e
commit
9735571967
@ -27,13 +27,17 @@ class GolemMember(models.Model):
|
|||||||
|
|
||||||
member_history_ids = fields.One2many('golem.member.history', 'member_id')
|
member_history_ids = fields.One2many('golem.member.history', 'member_id')
|
||||||
|
|
||||||
@api.constrains('gender', 'area_id', 'city', 'family_quotient', 'pcs_id', 'nationality_id')
|
@api.constrains('gender', 'area_id', 'city', 'family_quotient',
|
||||||
|
'pcs_id', 'nationality_id', 'season_ids')
|
||||||
def save_history(self):
|
def save_history(self):
|
||||||
|
""" save member history """
|
||||||
default_season = self.env['golem.season'].search([('is_default', '=', True)])
|
default_season = self.env['golem.season'].search([('is_default', '=', True)])
|
||||||
for member in self:
|
for member in self:
|
||||||
history = self.env['golem.member.history'].search([('member_id', '=', member.id),
|
history = self.env['golem.member.history'].search([
|
||||||
|
('member_id', '=', member.id),
|
||||||
('season_id', '=', default_season.id)])
|
('season_id', '=', default_season.id)])
|
||||||
if history:
|
if history:
|
||||||
|
|
||||||
history[0].write({'gender': member.gender,
|
history[0].write({'gender': member.gender,
|
||||||
'nationality_id': member.nationality_id.id,
|
'nationality_id': member.nationality_id.id,
|
||||||
'city': member.city,
|
'city': member.city,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user