From ddfedce0cf4e24d8ac9dd4665d5377937f2d9d3d Mon Sep 17 00:00:00 2001 From: michel Date: Mon, 29 Jan 2018 22:55:36 +0100 Subject: [PATCH] [TMP] Check the date start ans date end related to season date --- golem_activity/models/golem_activity.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/golem_activity/models/golem_activity.py b/golem_activity/models/golem_activity.py index 7f0a504..b9a26e8 100644 --- a/golem_activity/models/golem_activity.py +++ b/golem_activity/models/golem_activity.py @@ -102,6 +102,14 @@ class GolemActivity(models.Model): activity.date_start > activity.date_stop: raise models.ValidationError(_('Start of the period cannot be ' 'after end of the period.')) + if activity.season_id.date_start > activity.date_start < activity.season_id.date_end: + msg = _(u'Start of the period is in range of an ' + 'existing period.') + raise models.ValidationError(msg) + if activity.season_id.date_end < activity.date_stop > activity.season_id.date_start: + msg = _(u'End of the period is in range of an ' + 'existing period.') + raise models.ValidationError(msg) @api.onchange('season_id') def _onchange_season_dates(self):