Skip to content

Commit

Permalink
Merge pull request #1938 from frappe/version-15-hotfix
Browse files Browse the repository at this point in the history
chore: release v15
  • Loading branch information
krantheman authored Jul 3, 2024
2 parents 9162d29 + f624f96 commit 241760b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
17 changes: 16 additions & 1 deletion hrms/hr/doctype/hr_settings/hr_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
"idx": 1,
"issingle": 1,
"links": [],
"modified": "2024-05-08 00:40:32.809157",
"modified": "2024-06-26 15:20:17.802079",
"modified_by": "Administrator",
"module": "HR",
"name": "HR Settings",
Expand All @@ -337,6 +337,21 @@
"share": 1,
"write": 1
},
{
"email": 1,
"print": 1,
"read": 1,
"role": "HR Manager",
"share": 1,
"write": 1
},
{
"email": 1,
"print": 1,
"read": 1,
"role": "HR User",
"share": 1
},
{
"read": 1,
"role": "Employee"
Expand Down
2 changes: 1 addition & 1 deletion hrms/payroll/doctype/salary_slip/salary_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,7 @@ def get_lwp_or_ppl_for_date_range(employee, start_date, end_date):
& (LeaveApplication.status == "Approved")
& (LeaveApplication.employee == employee)
& ((LeaveApplication.salary_slip.isnull()) | (LeaveApplication.salary_slip == ""))
& ((LeaveApplication.from_date >= start_date) & (LeaveApplication.to_date <= end_date))
& ((LeaveApplication.from_date <= end_date) & (LeaveApplication.to_date >= start_date))
)
).run(as_dict=True)

Expand Down
15 changes: 15 additions & 0 deletions hrms/payroll/doctype/salary_slip/test_salary_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,21 @@ def test_payment_days_based_on_leave_application(self):

self.assertEqual(ss.payment_days, days_in_month - no_of_holidays - 3.75)

@change_settings("Payroll Settings", {"payroll_based_on": "Leave"})
def test_payment_days_calculation_for_varying_leave_ranges(self):
emp_id = make_employee("[email protected]")

make_leave_application(emp_id, "2024-06-28", "2024-07-03", "Leave Without Pay") # 3 days in July
make_leave_application(emp_id, "2024-07-10", "2024-07-13", "Leave Without Pay") # 4 days in July
make_leave_application(emp_id, "2024-07-28", "2024-08-05", "Leave Without Pay") # 3 days in July

ss = make_employee_salary_slip(
emp_id, "Monthly", "Test Payment Based On Leave Application", "2024-07-01"
)

self.assertEqual(ss.leave_without_pay, 10)
self.assertEqual(ss.payment_days, 17)

@change_settings("Payroll Settings", {"payroll_based_on": "Attendance"})
def test_payment_days_in_salary_slip_based_on_timesheet(self):
from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet
Expand Down

0 comments on commit 241760b

Please sign in to comment.