Check is date start

This commit is contained in:
michel 2017-11-15 14:57:27 +01:00
parent 0585672d52
commit e26e6fd1c7

View File

@ -75,6 +75,13 @@ class Event(models.Model):
raise ValidationError( raise ValidationError(
_('Date most be supperior to to start date')) _('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') @api.depends('date_start', 'date_end')
def _compute_duration(self): def _compute_duration(self):