diff --git a/models/event.py b/models/event.py index b5a68f5..a663be4 100644 --- a/models/event.py +++ b/models/event.py @@ -75,6 +75,13 @@ class Event(models.Model): raise ValidationError( _('Date most be supperior to to start date')) + @api.constrains('date_start') + def _check_date_start(self): + """Test si la modification de la date de fin n'est pas anterieur à la date de début""" + if self.date_end < self.date_start: + raise ValidationError( + _('Date most be inferior to to end date')) + @api.depends('date_start', 'date_end') def _compute_duration(self):