diff --git a/addons/hr_attendance/models/hr_employee.py b/addons/hr_attendance/models/hr_employee.py index 3521acb64de..8ff4baf4ebc 100644 --- a/addons/hr_attendance/models/hr_employee.py +++ b/addons/hr_attendance/models/hr_employee.py @@ -49,7 +49,9 @@ class HrEmployee(models.Model): @api.depends('attendance_ids') def _compute_last_attendance_id(self): for employee in self: - employee.last_attendance_id = employee.attendance_ids and employee.attendance_ids[0] or False + employee.last_attendance_id = self.env['hr.attendance'].search([ + ('employee_id', '=', employee.id), + ], limit=1) @api.depends('last_attendance_id.check_in', 'last_attendance_id.check_out', 'last_attendance_id') def _compute_attendance_state(self): diff --git a/doc/cla/corporate/camptocamp.md b/doc/cla/corporate/camptocamp.md index 206fad26646..e4206b66474 100644 --- a/doc/cla/corporate/camptocamp.md +++ b/doc/cla/corporate/camptocamp.md @@ -34,3 +34,4 @@ Damien Crier damien.crier@camptocamp.com https://github.com/damdam-s Simone Orsi simahawk@gmail.com https://github.com/simahawk Patrick Tombez patrick.tombez@camptocamp.com https://github.com/p-tombez Julien Coux julien.coux@camptocamp.com https://github.com/jcoux +Alexandre Saunier alexandre.saunier@camptocamp.com https://github.com/asaunier