forked from Yaltik/golem
Small refactorings
This commit is contained in:
parent
e5285ecebc
commit
473e3da65d
@ -30,13 +30,13 @@ class GolemFamily(models.Model):
|
||||
@api.constrains('city', 'country_id', 'member_ids')
|
||||
def save_family_history(self):
|
||||
""" save family history """
|
||||
default_season = self.env['golem.season'].search([('is_default', '=', True)])
|
||||
default_season = self.env['golem.season'].search([('is_default', '=', True)], limit=1)
|
||||
for family in self:
|
||||
history = self.env['golem.family.history'].search([
|
||||
('family_id', '=', family.id),
|
||||
('season_id', '=', default_season.id)])
|
||||
('season_id', '=', default_season.id)], limit=1)
|
||||
if history:
|
||||
history[0].write({
|
||||
history.write({
|
||||
'city': family.city,
|
||||
'country_id': family.country_id.id,
|
||||
'member_ids':[(6, False, family.member_ids.ids)]
|
||||
|
@ -31,14 +31,14 @@ class GolemMember(models.Model):
|
||||
'pcs_id', 'nationality_id', 'season_ids')
|
||||
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)], limit=1)
|
||||
for member in self:
|
||||
history = self.env['golem.member.history'].search([
|
||||
('member_id', '=', member.id),
|
||||
('season_id', '=', default_season.id)])
|
||||
('season_id', '=', default_season.id)], limit=1)
|
||||
if history:
|
||||
|
||||
history[0].write({'gender': member.gender,
|
||||
history.write({'gender': member.gender,
|
||||
'nationality_id': member.nationality_id.id,
|
||||
'city': member.city,
|
||||
'family_quotient': member.family_quotient,
|
||||
|
Loading…
Reference in New Issue
Block a user