Skip to content

Commit b0f068f

Browse files
committed
[FIX] hr_holidays_attendance: unlink overtime_id if not deductable
This commit fixes a bug that occurs when switching a leave request of type "Extra Hours" to another time-off type. The issue happens when editing a leave request that allows deduction from overtime, as it remains linked to attendance overtime that needs to be unlinked. task-4756706 closes odoo#216880 X-original-commit: 1b1a085 Signed-off-by: Yannick Tivisse (yti) <[email protected]> Signed-off-by: Ahmed Taha Abdelaziz (ahta) <[email protected]>
1 parent 4275147 commit b0f068f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

addons/hr_holidays_attendance/models/hr_leave.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def _check_overtime_deductible(self, leaves):
5252
# If the type of leave is overtime deductible, we have to check that the employee has enough extra hours
5353
for leave in leaves:
5454
if not leave.overtime_deductible:
55+
leave.overtime_id.sudo().unlink()
5556
continue
5657
employee = leave.employee_id.sudo()
5758
duration = leave.number_of_hours_display

0 commit comments

Comments
 (0)