Merge pull request #4462 from nabinhait/sal_slip_fix
[fix] Payment days calculation in salary slip
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js
index 9ed5c76..f2e5a9e 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.js
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.js
@@ -32,7 +32,7 @@
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
if (doc.employee && doc.fiscal_year && doc.month) {
- return $c_obj(doc, 'get_leave_details',doc.leave_without_pay,function(r, rt) {
+ return $c_obj(doc, 'get_leave_details', {"lwp": doc.leave_without_pay}, function(r, rt) {
var doc = locals[dt][dn];
cur_frm.refresh();
calculate_all(doc, dt, dn);
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 818c95e..671fbb8 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -90,14 +90,14 @@
start_date = joining_date
elif joining_date > month['month_end_date']:
return
-
+
+ end_date = month['month_end_date']
if relieving_date:
if relieving_date > start_date and relieving_date < month['month_end_date']:
end_date = relieving_date
elif relieving_date < month['month_start_date']:
- frappe.throw(_("Employee relieved on {0} must be set as 'Left'").format(relieving_date))
- else:
- end_date = month['month_end_date']
+ frappe.throw(_("Employee relieved on {0} must be set as 'Left'")
+ .format(relieving_date))
payment_days = date_diff(end_date, start_date) + 1