From e26e6fd1c7f03095dc3e9fa22aabc350749223b8 Mon Sep 17 00:00:00 2001 From: michel Date: Wed, 15 Nov 2017 14:57:27 +0100 Subject: [PATCH] Check is date start --- models/event.py | 7 +++++++ 1 file changed, 7 insertions(+) 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):