mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-18 12:39:18 +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:
|
if employee:
|
||||||
holiday_list, company = frappe.get_cached_value("Employee", employee, ["holiday_list", "company"])
|
holiday_list, company = frappe.get_cached_value("Employee", employee, ["holiday_list", "company"])
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -203,7 +203,25 @@ def is_holiday(holiday_list, date=None):
|
|||||||
if date is None:
|
if date is None:
|
||||||
date = today()
|
date = today()
|
||||||
if holiday_list:
|
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:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user