From 31c977b906bce8508a306f0fac53bbe55368b03e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 16:26:45 +0530 Subject: [PATCH] Fixed Employee Leave Balance Report --- .../report/employee_leave_balance/employee_leave_balance.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py index c1d8bcfba4..99b235e91a 100644 --- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py +++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py @@ -24,17 +24,19 @@ def execute(filters=None): else: fiscal_years = frappe.db.sql_list("select name from `tabFiscal Year` order by name desc") + employee_names = [d.name for d in employees] + allocations = frappe.db.sql("""select employee, fiscal_year, leave_type, total_leaves_allocated from `tabLeave Allocation` where docstatus=1 and employee in (%s)""" % - ','.join(['%s']*len(employees)), employees, as_dict=True) + ','.join(['%s']*len(employee_names)), employee_names, as_dict=True) applications = frappe.db.sql("""select employee, fiscal_year, leave_type, SUM(total_leave_days) as leaves from `tabLeave Application` where status="Approved" and docstatus = 1 and employee in (%s) group by employee, fiscal_year, leave_type""" % - ','.join(['%s']*len(employees)), employees, as_dict=True) + ','.join(['%s']*len(employee_names)), employee_names, as_dict=True) columns = [ "Fiscal Year", "Employee:Link/Employee:150", "Employee Name::200", "Department::150"