allow users without employee with hr permission to view all calendars

This commit is contained in:
RobertSchouten 2016-09-09 10:14:07 +08:00 committed by GitHub
parent e5d13f3156
commit e4d3809c87

View File

@ -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")