-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2665 from frappe/mergify/bp/version-14-hotfix/pr-…
…2602 fix: mark absence for default shift on non-overlapping dates if another shift assignment exists (backport #2602)
- Loading branch information
Showing
2 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -612,6 +612,27 @@ def test_skip_auto_attendance_for_overlapping_shift(self): | |
self.assertEqual(log_in.skip_auto_attendance, 1) | ||
self.assertEqual(log_out.skip_auto_attendance, 1) | ||
|
||
def test_mark_attendance_for_default_shift_when_shift_assignment_is_not_overlapping(self): | ||
shift_1 = setup_shift_type(shift_type="Deafult Shift", start_time="08:00:00", end_time="12:00:00") | ||
shift_2 = setup_shift_type(shift_type="Not Default Shift", start_time="10:00:00", end_time="18:00:00") | ||
employee = make_employee( | ||
"[email protected]", company="_Test Company", default_shift=shift_1.name | ||
) | ||
shift_assigned_date = add_days(getdate(), +1) | ||
make_shift_assignment(shift_2.name, employee, shift_assigned_date) | ||
from hrms.hr.doctype.attendance.attendance import mark_attendance | ||
|
||
mark_attendance(employee, add_days(getdate(), -1), "Present", shift=shift_1.name) | ||
shift_1.process_auto_attendance() | ||
self.assertEqual( | ||
frappe.db.get_value( | ||
"Attendance", | ||
{"employee": employee, "attendance_date": getdate(), "shift": shift_1.name}, | ||
"status", | ||
), | ||
"Absent", | ||
) | ||
|
||
|
||
def setup_shift_type(**args): | ||
args = frappe._dict(args) | ||
|