Skip to content

Commit

Permalink
[IMP]helpdesk: Added warning for 24 hours format.
Browse files Browse the repository at this point in the history
  • Loading branch information
hch-odoo authored and kirti-c committed Jan 9, 2018
1 parent 57ecab7 commit e9eb7eb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions addons/resource/models/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,14 @@ class ResourceCalendarAttendance(models.Model):
hour_to = fields.Float(string='Work to', required=True)
calendar_id = fields.Many2one("resource.calendar", string="Resource's Calendar", required=True, ondelete='cascade')

@api.constrains('hour_to', 'hour_from')
def _verify_hours(self):
for rec in self:
if rec.hour_from > 24 or rec.hour_to > 24:
raise ValidationError(_("Please enter hours between 1 to 24"))
if (rec.hour_to - rec.hour_from) <= 0:
raise ValidationError(_("Please use 24 hours format!"))


class ResourceResource(models.Model):
_name = "resource.resource"
Expand Down

0 comments on commit e9eb7eb

Please sign in to comment.