From e4d3809c87ae913f14cacc0fe64bb497ba1e509b Mon Sep 17 00:00:00 2001 From: RobertSchouten Date: Fri, 9 Sep 2016 10:14:07 +0800 Subject: [PATCH] allow users without employee with hr permission to view all calendars --- erpnext/hr/doctype/employee/employee.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index c6b3633c65..2e5fb26093 100755 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -219,7 +219,11 @@ def get_employees_who_are_born_today(): and status = 'Active'""", {"date": today()}, as_dict=True) def get_holiday_list_for_employee(employee, raise_exception=True): - holiday_list, company = frappe.db.get_value("Employee", employee, ["holiday_list", "company"]) + if employee: + holiday_list, company = frappe.db.get_value("Employee", employee, ["holiday_list", "company"]) + else: + holiday_list='' + company=frappe.db.get_value("Global Defaults", None, "default_company") if not holiday_list: holiday_list = frappe.db.get_value("Company", company, "default_holiday_list")