[IMP]GOLEM Activity : reset dates to season one if boolean fullseason is used

This commit is contained in:
Fabien BOURGEOIS 2018-03-08 11:06:53 +01:00
parent 9c241f4078
commit e5a9f4cd91
2 changed files with 11 additions and 1 deletions

View File

@ -18,7 +18,7 @@
{
'name': 'GOLEM activities',
'summary': 'Extends Odoo products for multi-activity',
'version': '10.0.2.1.1',
'version': '10.0.2.1.2',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne',
'license': 'AGPL-3',

View File

@ -50,6 +50,16 @@ class GolemActivity(models.Model):
is_fullseason = fields.Boolean('Is full season?',
compute='_compute_is_full_season')
@api.onchange('is_fullseason')
def onchange_fullseason(self):
""" Sets dates as season ones if needed """
for activity in self:
if activity.is_fullseason:
if activity.season_id.date_start:
activity.date_start = activity.season_id.date_start
if activity.season_id.date_end:
activity.date_stop = activity.season_id.date_end
@api.depends('date_start', 'date_stop')
def _compute_is_full_season(self):
""" Display date for is full season """