[IMP]GOLEM Activity default season at creation
This commit is contained in:
parent
358fbf8d61
commit
4ffedc5add
@ -39,8 +39,15 @@ class GolemActivity(models.Model):
|
|||||||
default_code = fields.Char(copy=True)
|
default_code = fields.Char(copy=True)
|
||||||
|
|
||||||
# Own fields
|
# Own fields
|
||||||
season_id = fields.Many2one('golem.season', string='Season',
|
|
||||||
copy=False, required=True)
|
@api.model
|
||||||
|
def _default_season(self):
|
||||||
|
""" Get default season """
|
||||||
|
domain = [('is_default', '=', True)]
|
||||||
|
return self.env['golem.season'].search(domain)
|
||||||
|
|
||||||
|
season_id = fields.Many2one('golem.season', string='Season', copy=False,
|
||||||
|
required=True, default=_default_season)
|
||||||
animator_id = fields.Many2one('res.partner', string='Animator',
|
animator_id = fields.Many2one('res.partner', string='Animator',
|
||||||
domain=[('is_company', '=', False)])
|
domain=[('is_company', '=', False)])
|
||||||
date_start = fields.Date('Start date', copy=False)
|
date_start = fields.Date('Start date', copy=False)
|
||||||
@ -70,8 +77,7 @@ class GolemActivity(models.Model):
|
|||||||
@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 """
|
||||||
domain = [('is_default', '=', True)]
|
default_season = self._default_season()
|
||||||
default_season = self.env['golem.season'].search(domain)
|
|
||||||
for a in self:
|
for a in self:
|
||||||
a.is_current = (default_season == a.season_id)
|
a.is_current = (default_season == a.season_id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user