[hotfix] fixes for https://github.com/frappe/erpnext/issues/9782 calculate leave without pay before subtracting holidays (#10355)

This commit is contained in:
Makarand Bauskar 2017-08-17 12:39:35 +05:30 committed by Nabin Hait
parent 64c32dcd59
commit 446c2b0e91

View File

@ -231,12 +231,12 @@ class SalarySlip(TransactionBase):
holidays = self.get_holidays_for_employee(self.start_date, self.end_date)
working_days = date_diff(self.end_date, self.start_date) + 1
actual_lwp = self.calculate_lwp(holidays, working_days)
if not cint(frappe.db.get_value("HR Settings", None, "include_holidays_in_total_working_days")):
working_days -= len(holidays)
if working_days < 0:
frappe.throw(_("There are more holidays than working days this month."))
actual_lwp = self.calculate_lwp(holidays, working_days)
if not lwp:
lwp = actual_lwp
elif lwp != actual_lwp: