From 0a76b8b29a2a35ba56b7ad367a67ed87164187a9 Mon Sep 17 00:00:00 2001 From: Valmik Jangla Date: Sat, 30 Jan 2016 10:59:40 +0530 Subject: [PATCH] Fixed issue where no Holidays would cause the report to break --- .../employee_holiday_attendance.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py index ac51b57274..bb68cf3c70 100644 --- a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py +++ b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py @@ -33,15 +33,17 @@ def get_employees(): for holiday in holidays: holidays_list.append(holiday.holiday_date) holiday_names[holiday.holiday_date] = holiday.description + if(holidays_list): + employee_list = frappe.db.sql("""select + employee, employee_name, att_date, status + from tabAttendance + where + att_date in ({0})""".format(', '.join(["%s"]*len(holidays_list))), + holidays_list, as_list=True) - employee_list = frappe.db.sql("""select - employee, employee_name, att_date, status - from tabAttendance - where - att_date in ({0})""".format(', '.join(["%s"]*len(holidays_list))), - holidays_list, as_list=True) + for employee_data in employee_list: + employee_data.append(holiday_names[employee_data[2]]) - for employee_data in employee_list: - employee_data.append(holiday_names[employee_data[2]]) - - return employee_list + return employee_list + else: + return None \ No newline at end of file