In current versions of ERPNext, Salary Slip will throw an error if the slip accounts for a period of time extending beyond a single Payroll Period.
Steps to reproduce the issue
Create a Payroll Period with a start and an end date.
Create a Salary Slip with start and end dates that are both inside and outside the Payroll Period.
Attempt to save Salary Slip
Observed result
Exception thrown: "Start and end dates not in a valid Payroll Period, cannot calculate Income Tax."
Expected result
Salary Slip is saved successfully.
Additional information
A very simple (though possibly unclean) solution would be to determine Payroll Period on the basis of the end date only. This could be done by changing the line below to payroll_period = get_payroll_period(self.end_date, self.end_date, self.company) .
More broadly, it's arguably more correct to determine which Payroll Period applies not on the basis of start and end dates but rather on the basis of the salary slip's posting date, since employee income taxes are typically calculated on a cash basis. This would represent a more fundamental change, however, with implications for other parts of the Income Tax calculation (especially in calculating the number of remaining sub-periods).
Description of the issue
In current versions of ERPNext, Salary Slip will throw an error if the slip accounts for a period of time extending beyond a single Payroll Period.
Steps to reproduce the issue
Observed result
Exception thrown: "Start and end dates not in a valid Payroll Period, cannot calculate Income Tax."
Expected result
Salary Slip is saved successfully.
Additional information
A very simple (though possibly unclean) solution would be to determine Payroll Period on the basis of the end date only. This could be done by changing the line below to
payroll_period = get_payroll_period(self.end_date, self.end_date, self.company)
.https://github.com/frappe/erpnext/blob/a31731e73d3faf53b319c9744ef8d9997fd865ce/erpnext/payroll/doctype/salary_slip/salary_slip.py#L446
More broadly, it's arguably more correct to determine which Payroll Period applies not on the basis of start and end dates but rather on the basis of the salary slip's posting date, since employee income taxes are typically calculated on a cash basis. This would represent a more fundamental change, however, with implications for other parts of the Income Tax calculation (especially in calculating the number of remaining sub-periods).