Merge branch 'V2' of fabien/michel_coworking into V2

This commit is contained in:
michel 2017-11-15 14:07:04 +00:00 committed by Gitea
commit 7cc3482546

View File

@ -68,20 +68,11 @@ class Event(models.Model):
raise models.ValidationError(_('You can have subscribed people ' raise models.ValidationError(_('You can have subscribed people '
'if event is not confirmed yet')) 'if event is not confirmed yet'))
@api.constrains('date_end') @api.constrains('date_start', 'date_end')
def _check_date_end(self): def _check_dates(self):
"""Test si la modification de la date n'est pas postérieur à la date de début""" """Test si la modification de la date de début est infnérieure à la date de fin"""
if self.date_start > self.date_end: if self.date_start > self.date_end:
raise ValidationError( raise ValidationError(_('End 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):