Skip to content
Snippets Groups Projects
Commit b86afb9f authored by Thomas Lefebvre (thle)'s avatar Thomas Lefebvre (thle)
Browse files

[FIX] hr_holidays_attendance: not blocking the refusal of leave


Steps to reproduce:
-------------------
- activate "Count Extra Hours" in Attendances settings;
- create attendances for an employee to create an overtime
(select one day of the weekend for example);
- create an Extra Hours type leave for this employee;
- remove the attendance that creates extra hours;

The extra hours of the employee is negative

- refuse the leave created before;

Issue:
------
A Validation Error occurs with the message:
"The employee does not have enough extra hours to extend this leave.".

Solution:
---------
Refuse leave based on extra hours
should not require any control
because we are not trying to extend leave.

opw-3342778

closes odoo/odoo#124219

Signed-off-by: default avatarKevin Baptiste <kba@odoo.com>
parent 0a6a8fc5
Branches
Tags
No related merge requests found
......@@ -36,6 +36,9 @@ class HRLeave(models.Model):
self._check_overtime_deductible(self)
#User may not have access to overtime_id field
for leave in self.sudo().filtered('overtime_id'):
# It must always be possible to refuse leave based on overtime
if vals.get('state') in ['refuse']:
continue
employee = leave.employee_id
duration = leave.number_of_hours_display
overtime_duration = leave.overtime_id.sudo().duration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment