[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:
@@ -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 "
|
||||
|
||||
Reference in New Issue
Block a user