diff --git a/hr_timesheet_sheet_attendance/models/hr_timesheet_sheet.py b/hr_timesheet_sheet_attendance/models/hr_timesheet_sheet.py index 66a571fb82..29354c0e10 100644 --- a/hr_timesheet_sheet_attendance/models/hr_timesheet_sheet.py +++ b/hr_timesheet_sheet_attendance/models/hr_timesheet_sheet.py @@ -87,21 +87,22 @@ def check_employee_attendance_state(self): ) ) - @api.model - def create(self, vals): - res = super(HrTimesheetSheet, self).create(vals) - attendances = self.env["hr.attendance"].search( - [ - ("employee_id", "=", res.employee_id.id), - ("sheet_id", "=", False), - ("check_in", ">=", res.date_start), - ("check_in", "<=", res.date_end), - "|", - ("check_out", "=", False), - "&", - ("check_out", ">=", res.date_start), - ("check_out", "<=", res.date_end), - ] - ) - attendances._compute_sheet_id() + @api.model_create_multi + def create(self, vals_list): + res = super().create(vals_list) + for res in res: + attendances = self.env["hr.attendance"].search( + [ + ("employee_id", "=", res.employee_id.id), + ("sheet_id", "=", False), + ("check_in", ">=", res.date_start), + ("check_in", "<=", res.date_end), + "|", + ("check_out", "=", False), + "&", + ("check_out", ">=", res.date_start), + ("check_out", "<=", res.date_end), + ] + ) + attendances._compute_sheet_id() return res