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')
|
@api.constrains('city', 'country_id', 'member_ids')
|
||||||
def save_family_history(self):
|
def save_family_history(self):
|
||||||
""" save family history """
|
""" 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:
|
for family in self:
|
||||||
history = self.env['golem.family.history'].search([
|
history = self.env['golem.family.history'].search([
|
||||||
('family_id', '=', family.id),
|
('family_id', '=', family.id),
|
||||||
('season_id', '=', default_season.id)])
|
('season_id', '=', default_season.id)], limit=1)
|
||||||
if history:
|
if history:
|
||||||
history[0].write({
|
history.write({
|
||||||
'city': family.city,
|
'city': family.city,
|
||||||
'country_id': family.country_id.id,
|
'country_id': family.country_id.id,
|
||||||
'member_ids':[(6, False, family.member_ids.ids)]
|
'member_ids':[(6, False, family.member_ids.ids)]
|
||||||
|
@ -31,19 +31,19 @@ class GolemMember(models.Model):
|
|||||||
'pcs_id', 'nationality_id', 'season_ids')
|
'pcs_id', 'nationality_id', 'season_ids')
|
||||||
def save_history(self):
|
def save_history(self):
|
||||||
""" save member history """
|
""" 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:
|
for member in self:
|
||||||
history = self.env['golem.member.history'].search([
|
history = self.env['golem.member.history'].search([
|
||||||
('member_id', '=', member.id),
|
('member_id', '=', member.id),
|
||||||
('season_id', '=', default_season.id)])
|
('season_id', '=', default_season.id)], limit=1)
|
||||||
if history:
|
if history:
|
||||||
|
|
||||||
history[0].write({'gender': member.gender,
|
history.write({'gender': member.gender,
|
||||||
'nationality_id': member.nationality_id.id,
|
'nationality_id': member.nationality_id.id,
|
||||||
'city': member.city,
|
'city': member.city,
|
||||||
'family_quotient': member.family_quotient,
|
'family_quotient': member.family_quotient,
|
||||||
'pcs_id': member.pcs_id.id,
|
'pcs_id': member.pcs_id.id,
|
||||||
'area_id': member.area_id.id})
|
'area_id': member.area_id.id})
|
||||||
else:
|
else:
|
||||||
self.env['golem.member.history'].create({'member_id': member.id,
|
self.env['golem.member.history'].create({'member_id': member.id,
|
||||||
'season_id': default_season.id,
|
'season_id': default_season.id,
|
||||||
|
Loading…
Reference in New Issue
Block a user