From c484930d311497364d00e7aec5e00e22d987df4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Thu, 15 Jan 2026 17:38:27 +0100 Subject: [PATCH] [IMP] hr_shift: Prevent TypeError Use case example: - Create an hr.shift.planning.line record with a start time of 00:00:00 and an end time of 08:00:00 - The employee must have a work schedule after 08:00:00 (for example, starting at 13:00:00) - The report from the hr_attendance_report_theoretical_time module is used. The hr_shift methods will mix records and cause an error. TypeError: cannot union different models: 'hr.shift.planning.line()' and 'resource.calendar.attendance()' TT60298 --- hr_shift/models/resource_calendar.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hr_shift/models/resource_calendar.py b/hr_shift/models/resource_calendar.py index badb53c..cd96ab1 100644 --- a/hr_shift/models/resource_calendar.py +++ b/hr_shift/models/resource_calendar.py @@ -58,7 +58,13 @@ def _attendance_intervals_batch( ] start_time = string_to_datetime(shift.start_time).astimezone(tz) end_time = string_to_datetime(shift.end_time).astimezone(tz) - intervals_to_add.append((start_time, end_time, shift)) + # noqa: E501 Prevent TypeError: TypeError: cannot union different models: 'hr.shift.planning.line()' and 'resource.calendar.attendance()' + interval_to_add_item = ( + resource_intervals[0][2] if resource_intervals else shift + ) + intervals_to_add.append( + (start_time, end_time, interval_to_add_item) + ) res[resource.id]._items = [ x for x in resource_intervals if x not in intervals_to_remove ] + intervals_to_add