forked from Yaltik/golem
[FIX]GOLEM fix default season button (recmputing all is_current)
This commit is contained in:
parent
4a9cec73c9
commit
dd2802da24
@ -69,10 +69,10 @@ class GolemActivity(models.Model):
|
|||||||
ondelete='restrict')
|
ondelete='restrict')
|
||||||
|
|
||||||
is_current = fields.Boolean('Current season?', store=True, default=False,
|
is_current = fields.Boolean('Current season?', store=True, default=False,
|
||||||
compute='_compute_is_current')
|
compute='compute_is_current')
|
||||||
|
|
||||||
@api.depends('season_id')
|
@api.depends('season_id')
|
||||||
def _compute_is_current(self):
|
def compute_is_current(self):
|
||||||
""" Checks if activity is active for current season """
|
""" Checks if activity is active for current season """
|
||||||
default_season = self._default_season()
|
default_season = self._default_season()
|
||||||
for activity in self:
|
for activity in self:
|
||||||
|
@ -75,7 +75,7 @@ class GolemMember(models.Model):
|
|||||||
required=True, default=_default_season,
|
required=True, default=_default_season,
|
||||||
ondelete='restrict')
|
ondelete='restrict')
|
||||||
is_current = fields.Boolean('Current user?', default=False, readonly=True,
|
is_current = fields.Boolean('Current user?', default=False, readonly=True,
|
||||||
store=True, compute='_compute_is_current')
|
store=True, compute='compute_is_current')
|
||||||
is_number_manual = fields.Boolean('Is number manual?', store=False,
|
is_number_manual = fields.Boolean('Is number manual?', store=False,
|
||||||
compute='_compute_is_number_manual')
|
compute='_compute_is_number_manual')
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class GolemMember(models.Model):
|
|||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends('season_ids')
|
@api.depends('season_ids')
|
||||||
def _compute_is_current(self):
|
def compute_is_current(self):
|
||||||
""" Computes is current according to seasons """
|
""" Computes is current according to seasons """
|
||||||
default_s = self._default_season()
|
default_s = self._default_season()
|
||||||
for member in self:
|
for member in self:
|
||||||
|
@ -71,10 +71,10 @@ class GolemSeason(models.Model):
|
|||||||
self.is_default = True
|
self.is_default = True
|
||||||
if 'golem.member' in self.env.registry:
|
if 'golem.member' in self.env.registry:
|
||||||
all_members = self.env['golem.member'].search([])
|
all_members = self.env['golem.member'].search([])
|
||||||
all_members._compute_is_current()
|
all_members.compute_is_current()
|
||||||
all_members._generate_number()
|
all_members.generate_number()
|
||||||
if 'golem.activity' in self.env.registry:
|
if 'golem.activity' in self.env.registry:
|
||||||
self.env['golem.activity'].search([])._compute_is_current()
|
self.env['golem.activity'].search([]).compute_is_current()
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@api.returns('self', lambda rec: rec.id)
|
@api.returns('self', lambda rec: rec.id)
|
||||||
|
Loading…
Reference in New Issue
Block a user