forked from Yaltik/golem
check slot hours consistence
This commit is contained in:
parent
288dc18056
commit
42cec4f0e1
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user