forked from Yaltik/golem
[TMP] load membership type date if exist
This commit is contained in:
parent
485a45f217
commit
f1a4380a85
@ -38,6 +38,16 @@ class GolemSeason(models.Model):
|
||||
date_start = fields.Date('Period start')
|
||||
date_end = fields.Date('Period end')
|
||||
|
||||
@api.onchange('membership_id')
|
||||
def _onchange_season_dates(self):
|
||||
""" Sets defaults dates according to membership type """
|
||||
for activity in self:
|
||||
if activity.membership_id:
|
||||
if not activity.date_start:
|
||||
activity.date_start = activity.membership_id.membership_date_from
|
||||
if not activity.date_end:
|
||||
activity.date_end = activity.membership_id.membership_date_to
|
||||
|
||||
@api.constrains('date_start', 'date_end')
|
||||
def _check_period(self):
|
||||
""" Check if end date if after start date and if there is no conflict
|
||||
|
Loading…
x
Reference in New Issue
Block a user