-
Notifications
You must be signed in to change notification settings - Fork 688
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 #2179 from frappe/mergify/bp/version-15-hotfix/pr-…
…2177 feat(Monthly Attendance Sheet): add Include Company Descendants filter (backport #2177)
- Loading branch information
Showing
4 changed files
with
52 additions
and
9 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 |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
make_holiday_list, | ||
make_leave_application, | ||
) | ||
from hrms.tests.test_utils import get_first_day_for_prev_month | ||
from hrms.tests.test_utils import create_company, get_first_day_for_prev_month | ||
|
||
|
||
class TestMonthlyAttendanceSheet(FrappeTestCase): | ||
|
@@ -281,6 +281,35 @@ def test_attendance_with_employee_filter(self): | |
self.assertEqual(present[1], 1) | ||
self.assertEqual(leaves[2], 1) | ||
|
||
def test_attendance_with_company_filter(self): | ||
create_company("Test Parent Company", is_group=1) | ||
create_company("Test Child Company", is_group=1, parent_company="Test Parent Company") | ||
create_company("Test Grandchild Company", parent_company="Test Child Company") | ||
|
||
employee1 = make_employee("[email protected]", company="Test Parent Company") | ||
employee2 = make_employee("[email protected]", company="Test Child Company") | ||
employee3 = make_employee("[email protected]", company="Test Grandchild Company") | ||
|
||
previous_month_first = get_first_day_for_prev_month() | ||
mark_attendance(employee1, previous_month_first, "Present") | ||
mark_attendance(employee2, previous_month_first, "Present") | ||
mark_attendance(employee3, previous_month_first, "Present") | ||
|
||
filters = frappe._dict( | ||
{ | ||
"month": previous_month_first.month, | ||
"year": previous_month_first.year, | ||
"company": "Test Parent Company", | ||
"include_company_descendants": 1, | ||
} | ||
) | ||
report = execute(filters=filters) | ||
self.assertEqual(len(report[1]), 3) | ||
|
||
filters.include_company_descendants = 0 | ||
report = execute(filters=filters) | ||
self.assertEqual(len(report[1]), 1) | ||
|
||
def test_attendance_with_employee_filter_and_summarized_view(self): | ||
previous_month_first = get_first_day_for_prev_month() | ||
|
||
|
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