You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[FIX] hr_attendance: count lunch intervals in attendance auto check out
**Issue**
For example, in the case of a working schedule from 8:00 to 17:00 with
a 1 hour lunch period, 8 hours of work are expected. By taking the
lunch interval into account, the auto check out will happen at 17:00
if the company's tolerance in the attendance's setting is set at 0.
Previously, it would happen at 16:00, resulting in only 7 worked hours
for the attendance while the user may expect the attendance's worked
hours to match the expected working hours of the schedule.
**Solution**
- include lunch attendances (not taken into account by `duration_hours`)
in the total time that needs to be exceeded before an `hr.attendance` is
automatically checked out.
Note that this solution manages the case where `hr.attendance` are outside
lunch periods (e.g. 8-12 and 13-17, but no attendance between 12-13). Though
in that case, the automatic check out will be delayed by at least 1h.
Note: a change was also made to account for 2 weeks calendars.
opw-4402321
closesodoo#210921
X-original-commit: 179c043
Signed-off-by: Tanguy Quéguineur (taqu) <[email protected]>
Signed-off-by: Bertrand Dossogne (bedo) <[email protected]>
# Attendances where Last open attendance worked time + previously worked time on that day + tolerance greater than the planned worked hours in his calendar
# Attendances where Last open attendance time + previously worked time on that day + tolerance greater than the attendances hours (including lunch) in his calendar
expected_worked_hours=sum(att.employee_id.resource_calendar_id.attendance_ids.filtered(lambdaa: a.dayofweek==str(att.check_in.weekday()) and (nota.two_weeks_calendarora.week_type==str(a.get_week_type(att.check_in.date())))).mapped("duration_hours"))
0 commit comments