[IMP]hr_employee_stats_sheet:read the planned hours of all the days at once

The planned hours of each day searched the employee calendar history,
then the calendar attendances, day by day. The days computed together now
share one search of the calendar histories and one of the attendances.

The calendar of a day is chosen by the same rule as before, now in
``_select_stats_calendar`` and shared with
``_get_calendar_in_progress_during_a_time_period``: the history line
covering the day, else the company calendar, and an error when two lines
cover it.

Assisted-by: Claude:claude-opus-5-5
Assisted-by: GPT:gpt-6.1-sol
Assisted-by: GPT:gpt-6.2-astra-ultrafast
This commit is contained in:
Valentin Lab
2026-11-19 14:09:23 +01:00
parent 12de36565a
commit 21cca44604
3 changed files with 86 additions and 25 deletions

View File

@@ -23,6 +23,14 @@ class HrEmployee(models.Model):
("date_end", ">=", date_start), # date de fin après le début
],
)
return self._select_stats_calendar(calendars)
def _select_stats_calendar(self, calendars):
"""
get the ressource calendar to use, given the hr_employee_calendar
lines running over the period
"""
self.ensure_one()
if len(calendars) > 1:
raise UserError(
_("There is a calendar starting during the timesheet sheet time period for the employee %s "