Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions hr_timesheet_sheet_attendance/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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