Skip to content

Commit f823815

Browse files
committed
[16.0][FIX] hr_timesheet_sheet_attendance: Change create method to model_create_multi
1 parent 22d73ad commit f823815

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

hr_timesheet_sheet_attendance/models/hr_timesheet_sheet.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,22 @@ def check_employee_attendance_state(self):
8787
)
8888
)
8989

90-
@api.model
91-
def create(self, vals):
92-
res = super(HrTimesheetSheet, self).create(vals)
93-
attendances = self.env["hr.attendance"].search(
94-
[
95-
("employee_id", "=", res.employee_id.id),
96-
("sheet_id", "=", False),
97-
("check_in", ">=", res.date_start),
98-
("check_in", "<=", res.date_end),
99-
"|",
100-
("check_out", "=", False),
101-
"&",
102-
("check_out", ">=", res.date_start),
103-
("check_out", "<=", res.date_end),
104-
]
105-
)
106-
attendances._compute_sheet_id()
90+
@api.model_create_multi
91+
def create(self, vals_list):
92+
res = super().create(vals_list)
93+
for res in res:
94+
attendances = self.env["hr.attendance"].search(
95+
[
96+
("employee_id", "=", res.employee_id.id),
97+
("sheet_id", "=", False),
98+
("check_in", ">=", res.date_start),
99+
("check_in", "<=", res.date_end),
100+
"|",
101+
("check_out", "=", False),
102+
"&",
103+
("check_out", ">=", res.date_start),
104+
("check_out", "<=", res.date_end),
105+
]
106+
)
107+
attendances._compute_sheet_id()
107108
return res

0 commit comments

Comments
 (0)