[FIX]hr_employee_stats_sheet:remove invalid or inactive recoveries from total_recovery_hours in timesheet_sheet statistics

This commit is contained in:
2026-10-16 15:19:27 +02:00
parent 76c8eab917
commit 872826e2eb
3 changed files with 84 additions and 5 deletions

View File

@@ -109,6 +109,7 @@ class HrEmployeeStats(models.Model):
return total_planned_hours
def _get_total_recovery_hours(self):
#TODO: duplicated code with _get_total_leave_hours, to refactor later
self.ensure_one()
recovery = self.env["hr.leave"]
total_recovery_hours = 0
@@ -119,6 +120,8 @@ class HrEmployeeStats(models.Model):
("holiday_status_id", "=", self._get_holiday_status_id()),
("request_date_from", "<=", self.date),
("request_date_to", ">=", self.date),
("state", '=', 'validate'),
("active", '=', True),
],
)
for recovery_id in recovery_ids: