Merge pull request #6321 from RobertSchouten/patch-22

allow users without employee with hr permission to view all calendars
This commit is contained in:
Nabin Hait 2016-09-12 18:52:45 +05:30 committed by GitHub
commit b7c5b76ed1
2 changed files with 10 additions and 5 deletions

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

View File

@ -364,10 +364,11 @@ def get_events(start, end):
employee = frappe.db.get_value("Employee", {"user_id": frappe.session.user}, ["name", "company"],
as_dict=True)
if not employee:
return events
employee, company = employee.name, employee.company
if employee:
employee, company = employee.name, employee.company
else:
employee=''
company=frappe.db.get_value("Global Defaults", None, "default_company")
from frappe.desk.reportview import build_match_conditions
match_conditions = build_match_conditions("Leave Application")