Activités : inscription par créneau interne #41

Open
youssef wants to merge 15 commits from youssef/GOLEM:activites_inscription_par_creneau_interne into master
1 changed files with 10 additions and 0 deletions
Showing only changes of commit 42cec4f0e1 - Show all commits

View File

@ -33,3 +33,13 @@ class GolemActivityRegistrationSlot(models.Model):
ondelete='cascade', index=True)
hour_start = fields.Float('Start time')
hour_stop = fields.Float('Stop time')
@api.constrains('hour_start', 'hour_stop')
def check_slot_hours(self):
""" Check slot hours consistence """
for slot in self:
if slot.hour_start < slot.activity_id.hour_start or \
slot.hour_stop > slot.activity_id.hour_stop:
verr = _(u'Slot start and stop must be between activity start and'
' activity stop.')
raise ValidationError(verr)