[FIX] hr_attendance: allow multiple attendances
If the search returns more than one result, the rendering of the message would crash (SingletonError when accessing check_in field value). Use the same order and limit as both search before and after Courtesy of David Tran Closes odoo/odoo#28055
This commit is contained in:
@@ -81,7 +81,7 @@ class HrAttendance(models.Model):
|
||||
('employee_id', '=', attendance.employee_id.id),
|
||||
('check_out', '=', False),
|
||||
('id', '!=', attendance.id),
|
||||
])
|
||||
], order='check_in desc', limit=1)
|
||||
if no_check_out_attendances:
|
||||
raise exceptions.ValidationError(_("Cannot create new attendance record for %(empl_name)s, the employee hasn't checked out since %(datetime)s") % {
|
||||
'empl_name': attendance.employee_id.name_related,
|
||||
|
||||
Reference in New Issue
Block a user