diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py index 54618c563..507e70548 100644 --- a/yuthon_hr_attendance/models/overtime_approval.py +++ b/yuthon_hr_attendance/models/overtime_approval.py @@ -114,6 +114,7 @@ class OvertimeApprovals(models.Model): @api.depends('start_time', 'end_time', 'attendance_id', 'rest_start_time', 'rest_end_time') def _compute_duration(self): for rec in self: + max_hours = 99 rec.duration = 0.0 rec.overtime_hours = 0.0 if not (rec.start_time and rec.end_time): @@ -150,8 +151,9 @@ class OvertimeApprovals(models.Model): else: rec.duration = calculated_hours - if rec.rest_end_time and rec.rest_end_time: - rec.duration -= (rec.rest_end_time - rec.c).total_seconds() / 3600 + if rec.rest_end_time and rec.rest_start_time: + calculated_hours -= (rec.rest_end_time - rec.rest_start_time).total_seconds() / 3600 + rec.duration = min(calculated_hours, max_hours) employee = rec.users_id.employee_id if not employee: diff --git a/yuthon_hr_attendance/views/overtime_approval.xml b/yuthon_hr_attendance/views/overtime_approval.xml index cb1fca784..52bc21e73 100644 --- a/yuthon_hr_attendance/views/overtime_approval.xml +++ b/yuthon_hr_attendance/views/overtime_approval.xml @@ -62,6 +62,7 @@ +