From 679c813ec79f2c2d4baab5851e27422a996f3772 Mon Sep 17 00:00:00 2001 From: Mahamadasif Ansari Date: Thu, 9 Nov 2023 12:23:12 +0000 Subject: [PATCH] [FIX] hr_attendance: not filter attendance without check out MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, an error occurs when the user tries to open an employees who checks in but does not check out. Steps to produce: 1. Install 'hr_attendance' 2. Open AttendenceĀ > Attendences > create new 3. Set check In date previous month and no add Check out 4. Open employees > try to open current user Error: `'<=' not supported between instances of 'bool' and 'datetime.datetime'` This is because https://github.com/odoo/odoo/pull/140629 added [1] in the filter, but in certain cases, the `att.check_out` may not be present. This commit fixes the above issue by filtering attendees who have a check-out date. [1]-https://github.com/odoo/odoo/blob/46f2a019bd141389233257f24f0ddae05b0fa008/addons/hr_attendance/models/hr_employee.py#L82 sentry-4616207347 closes odoo/odoo#141771 X-original-commit: b0cb1ad7b43a296b91377df80b30cbd3976553b4 Signed-off-by: Sofie Gvaladze (sgv) --- addons/hr_attendance/models/hr_employee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_attendance/models/hr_employee.py b/addons/hr_attendance/models/hr_employee.py index 064278e0b2c..8dd238df67d 100644 --- a/addons/hr_attendance/models/hr_employee.py +++ b/addons/hr_attendance/models/hr_employee.py @@ -101,7 +101,7 @@ class HrEmployee(models.Model): hours = sum( att.worked_hours or 0 for att in employee.attendance_ids.filtered( - lambda att: att.check_in >= start_naive and att.check_out <= end_naive + lambda att: att.check_in >= start_naive and att.check_out and att.check_out <= end_naive ) )