[FIX]GOLEM fix default season button (recmputing all is_current)

This commit is contained in:
Fabien BOURGEOIS 2017-05-02 01:31:45 +02:00
parent 4a9cec73c9
commit dd2802da24
3 changed files with 7 additions and 7 deletions

View File

@ -69,10 +69,10 @@ class GolemActivity(models.Model):
ondelete='restrict')
is_current = fields.Boolean('Current season?', store=True, default=False,
compute='_compute_is_current')
compute='compute_is_current')
@api.depends('season_id')
def _compute_is_current(self):
def compute_is_current(self):
""" Checks if activity is active for current season """
default_season = self._default_season()
for activity in self:

View File

@ -75,7 +75,7 @@ class GolemMember(models.Model):
required=True, default=_default_season,
ondelete='restrict')
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,
compute='_compute_is_number_manual')
@ -85,7 +85,7 @@ class GolemMember(models.Model):
@api.multi
@api.depends('season_ids')
def _compute_is_current(self):
def compute_is_current(self):
""" Computes is current according to seasons """
default_s = self._default_season()
for member in self:

View File

@ -71,10 +71,10 @@ class GolemSeason(models.Model):
self.is_default = True
if 'golem.member' in self.env.registry:
all_members = self.env['golem.member'].search([])
all_members._compute_is_current()
all_members._generate_number()
all_members.compute_is_current()
all_members.generate_number()
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.returns('self', lambda rec: rec.id)