-
Notifications
You must be signed in to change notification settings - Fork 721
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 #1522 from frappe/version-15-hotfix
chore: release v15
- Loading branch information
Showing
7 changed files
with
125 additions
and
42 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
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 |
---|---|---|
|
@@ -230,17 +230,32 @@ def test_multiple_shift_assignments_for_same_day(self): | |
def test_calendar(self): | ||
employee1 = make_employee("[email protected]", company="_Test Company") | ||
employee2 = make_employee("[email protected]", company="_Test Company") | ||
employee3 = make_employee("[email protected]", company="_Test Company") | ||
|
||
shift_type = setup_shift_type(shift_type="Shift 1", start_time="08:00:00", end_time="12:00:00") | ||
date = getdate() | ||
shift1 = make_shift_assignment(shift_type.name, employee1, date) | ||
make_shift_assignment(shift_type.name, employee2, date) | ||
shift1 = make_shift_assignment(shift_type.name, employee1, date) # 1 day | ||
make_shift_assignment(shift_type.name, employee2, date) # excluded due to employee filter | ||
make_shift_assignment( | ||
shift_type.name, employee3, add_days(date, -3), add_days(date, -2) | ||
) # excluded | ||
shift2 = make_shift_assignment(shift_type.name, employee3, add_days(date, -1), date) # 2 days | ||
shift3 = make_shift_assignment( | ||
shift_type.name, employee3, add_days(date, 1), add_days(date, 2) | ||
) # 2 days | ||
shift4 = make_shift_assignment( | ||
shift_type.name, employee3, add_days(date, 30), add_days(date, 30) | ||
) # 1 day | ||
make_shift_assignment(shift_type.name, employee3, add_days(date, 31)) # excluded | ||
|
||
events = get_events( | ||
start=date, end=date, filters=[["Shift Assignment", "employee", "=", employee1, False]] | ||
start=date, | ||
end=add_days(date, 30), | ||
filters=[["Shift Assignment", "employee", "!=", employee2, False]], | ||
) | ||
self.assertEqual(len(events), 1) | ||
self.assertEqual(events[0]["name"], shift1.name) | ||
self.assertEqual(len(events), 6) | ||
for shift in events: | ||
self.assertIn(shift["name"], [shift1.name, shift2.name, shift3.name, shift4.name]) | ||
|
||
def test_calendar_for_night_shift(self): | ||
employee1 = make_employee("[email protected]", company="_Test Company") | ||
|
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
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 |
---|---|---|
|
@@ -570,6 +570,55 @@ def test_consider_marked_attendance_on_holidays_with_unmarked_attendance(self): | |
# no_of_days - period before DOJ | ||
self.assertEqual(ss.payment_days, no_of_days[0] - 3 - 1) | ||
|
||
@change_settings( | ||
"Payroll Settings", | ||
{ | ||
"payroll_based_on": "Attendance", | ||
"consider_unmarked_attendance_as": "Present", | ||
"include_holidays_in_total_working_days": 1, | ||
"consider_marked_attendance_on_holidays": 0, | ||
}, | ||
) | ||
def test_consider_marked_attendance_on_holidays_with_half_day_on_holiday(self): | ||
from erpnext.setup.doctype.holiday_list.holiday_list import is_holiday | ||
|
||
no_of_days = get_no_of_days() | ||
month_start_date, month_end_date = get_first_day(nowdate()), get_last_day(nowdate()) | ||
joining_date = add_days(month_start_date, 3) | ||
|
||
emp_id = make_employee( | ||
"[email protected]", | ||
status="Active", | ||
date_of_joining=joining_date, | ||
relieving_date=None, | ||
) | ||
|
||
for days in range(date_diff(month_end_date, joining_date) + 1): | ||
date = add_days(joining_date, days) | ||
if not is_holiday("Salary Slip Test Holiday List", date): | ||
mark_attendance(emp_id, date, "Present", ignore_validate=True) | ||
|
||
# mark half day on holiday | ||
first_sunday = get_first_sunday(for_date=joining_date, find_after_for_date=True) | ||
mark_attendance(emp_id, first_sunday, "Half Day", ignore_validate=True) | ||
|
||
ss = make_employee_salary_slip( | ||
emp_id, | ||
"Monthly", | ||
"Test Salary Slip With Holidays Included", | ||
) | ||
|
||
self.assertEqual(ss.total_working_days, no_of_days[0]) | ||
# no_of_days - period before DOJ | ||
self.assertEqual(ss.payment_days, no_of_days[0] - 3) | ||
|
||
# enable consider marked attendance on holidays | ||
frappe.db.set_single_value("Payroll Settings", "consider_marked_attendance_on_holidays", 1) | ||
ss.save() | ||
self.assertEqual(ss.total_working_days, no_of_days[0]) | ||
# no_of_days - period before DOJ - 0.5 LWP on holiday (half day present) | ||
self.assertEqual(ss.payment_days, no_of_days[0] - 3 - 0.5) | ||
|
||
@change_settings("Payroll Settings", {"include_holidays_in_total_working_days": 1}) | ||
def test_payment_days(self): | ||
from hrms.payroll.doctype.salary_structure.test_salary_structure import ( | ||
|