From 5d8635a8dc5213e40d034e22243a3831ab751366 Mon Sep 17 00:00:00 2001 From: Mayur Patel Date: Mon, 24 Nov 2014 16:57:53 +0000 Subject: [PATCH] Update leave_application.py See issue #2422 for more detail. --- erpnext/hr/doctype/leave_application/leave_application.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index 50d1d6faaa..63eb7961c4 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -204,6 +204,8 @@ def get_holidays(leave_app): tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2, `tabEmployee` e1 where e1.name = %s and h1.parent = h2.name and e1.holiday_list = h2.name and h1.holiday_date between %s and %s""", (leave_app.employee, leave_app.from_date, leave_app.to_date)) + # below line is needed. If an employee hasn't been assigned with any holiday list then above will return 0 rows. + tot_hol=tot_hol and flt(tot_hol[0][0]) or 0 if not tot_hol: tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2 where h1.parent = h2.name and h1.holiday_date between %s and %s