mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-16 16:15:02 +00:00
feat: half day in holiday list
This commit is contained in:
@@ -254,7 +254,11 @@ def get_employee_email(employee_doc):
|
||||
)
|
||||
|
||||
|
||||
def get_holiday_list_for_employee(employee, raise_exception=True):
|
||||
def get_holiday_list_for_employee(employee, raise_exception=True, as_on=None):
|
||||
hrms_override = frappe.get_hooks("employee_holiday_list")
|
||||
|
||||
if hrms_override:
|
||||
return frappe.get_attr(hrms_override[-1])(employee, raise_exception, as_on)
|
||||
if employee:
|
||||
holiday_list, company = frappe.get_cached_value("Employee", employee, ["holiday_list", "company"])
|
||||
else:
|
||||
|
||||
@@ -203,7 +203,25 @@ def is_holiday(holiday_list, date=None):
|
||||
if date is None:
|
||||
date = today()
|
||||
if holiday_list:
|
||||
return bool(frappe.db.exists("Holiday", {"parent": holiday_list, "holiday_date": date}, cache=True))
|
||||
return bool(
|
||||
frappe.db.exists(
|
||||
"Holiday", {"parent": holiday_list, "holiday_date": date, "is_half_day": 0}, cache=True
|
||||
)
|
||||
)
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def is_half_holiday(holiday_list, date=None):
|
||||
"""Returns true if the given date is a half holiday in the given holiday list"""
|
||||
if date is None:
|
||||
date = today()
|
||||
if holiday_list:
|
||||
return bool(
|
||||
frappe.db.exists(
|
||||
"Holiday", {"parent": holiday_list, "holiday_date": date, "is_half_day": 1}, cache=True
|
||||
)
|
||||
)
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user