Skip to content

Commit

Permalink
fixup! [ADD] hr_attendance_break
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrunn committed Nov 13, 2023
1 parent c8f95f3 commit 2230ab9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions hr_attendance_break/models/hr_attendance_break.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def _check_times(self):
("begin", "<", this.end),
("end", ">", this.begin),
("id", "not in", this.ids),
("attendance_id", "=", this.attendance_id.id),
]
)
)
Expand Down
15 changes: 14 additions & 1 deletion hr_attendance_break/tests/test_hr_attendance_break.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,18 @@ def test_overlap(self):
"end": datetime.datetime(2023, 8, 21, 8, 30, 0),
}
)
with self.assertRaises(exceptions.ValidationError):
with self.assertRaises(exceptions.ValidationError), self.env.cr.savepoint():
self.attendance.break_ids[0].end = datetime.datetime(2023, 8, 21, 8, 0, 1)
# but be sure that breaks of different users may overlap
attendance_demo_user = self.attendance.create(
self.attendance.copy_data(
default={"employee_id": self.env.ref("hr.employee_qdp").id}
)
)
self.env["hr.attendance.break"].create(
{
"attendance_id": attendance_demo_user.id,
"begin": datetime.datetime(2023, 8, 21, 8, 0, 0),
"end": datetime.datetime(2023, 8, 21, 8, 30, 0),
}
)

0 comments on commit 2230ab9

Please sign in to comment.