Fixed include holiday logic in leave calculation

This commit is contained in:
Nabin Hait 2015-07-30 14:48:31 +05:30
parent 17405d4130
commit d8546c4316

View File

@ -239,14 +239,15 @@ def get_total_leave_days(leave_app):
if not leave_app.half_day: if not leave_app.half_day:
tot_days = date_diff(leave_app.to_date, leave_app.from_date) + 1 tot_days = date_diff(leave_app.to_date, leave_app.from_date) + 1
if frappe.db.get_value("Leave Type", leave_app.leave_type, "include_holiday"): if frappe.db.get_value("Leave Type", leave_app.leave_type, "include_holiday"):
ret = {
'total_leave_days' : flt(tot_days)
}
else:
holidays = leave_app.get_holidays() holidays = leave_app.get_holidays()
ret = { ret = {
'total_leave_days' : flt(tot_days)-flt(holidays) 'total_leave_days' : flt(tot_days)-flt(holidays)
} }
else:
ret = {
'total_leave_days' : flt(tot_days)
}
return ret return ret
@frappe.whitelist() @frappe.whitelist()