* feat: Add reminders section to HR Settings
* refactor: Extract generic function for getting Employees
* feat: Employee Work Anniversary Reminder
* feat: Daily Holiday Reminder
* fix: Unnecessary params and replace [] with .get()
* test: Daily Holiday Reminders
* test: is_holiday basic tests
* refactor: Move employee reminders code to separate module
* feat: Add advance reminder to HR settings
* feat: Advance Holiday Reminders
* refactor: get_holidays_for_employee
* feat: Email holiday reminders in advance + tests
* fix: Remove unused import
* refactor: HR Setting Reminder Section
* refactor: Remove Daily Holiday Reminders feat
* feat: Reminder miss warning
* fix: Failing test and function name change
* chore: Add patch for field rename
* chore: Rename frequency label
* fix: Failing patch test
* fix: sider and removed description of fields
* fix: email alignment
Co-authored-by: pateljannat <pateljannat2308@gmail.com>
Co-authored-by: Jannat Patel <31363128+pateljannat@users.noreply.github.com>
(cherry picked from commit 24b2a31581)
Co-authored-by: Mohammad Hussain Nagaria <34810212+NagariaHussain@users.noreply.github.com>
Co-authored-by: Jannat Patel <31363128+pateljannat@users.noreply.github.com>
This commit is contained in:
@@ -335,21 +335,44 @@ def get_sal_slip_total_benefit_given(employee, payroll_period, component=False):
|
||||
total_given_benefit_amount = sum_of_given_benefit[0].total_amount
|
||||
return total_given_benefit_amount
|
||||
|
||||
def get_holidays_for_employee(employee, start_date, end_date):
|
||||
holiday_list = get_holiday_list_for_employee(employee)
|
||||
def get_holiday_dates_for_employee(employee, start_date, end_date):
|
||||
"""return a list of holiday dates for the given employee between start_date and end_date"""
|
||||
# return only date
|
||||
holidays = get_holidays_for_employee(employee, start_date, end_date)
|
||||
|
||||
return [cstr(h.holiday_date) for h in holidays]
|
||||
|
||||
holidays = frappe.db.sql_list('''select holiday_date from `tabHoliday`
|
||||
where
|
||||
parent=%(holiday_list)s
|
||||
and holiday_date >= %(start_date)s
|
||||
and holiday_date <= %(end_date)s''', {
|
||||
"holiday_list": holiday_list,
|
||||
"start_date": start_date,
|
||||
"end_date": end_date
|
||||
})
|
||||
|
||||
holidays = [cstr(i) for i in holidays]
|
||||
def get_holidays_for_employee(employee, start_date, end_date, raise_exception=True, only_non_weekly=False):
|
||||
"""Get Holidays for a given employee
|
||||
|
||||
`employee` (str)
|
||||
`start_date` (str or datetime)
|
||||
`end_date` (str or datetime)
|
||||
`raise_exception` (bool)
|
||||
`only_non_weekly` (bool)
|
||||
|
||||
return: list of dicts with `holiday_date` and `description`
|
||||
"""
|
||||
holiday_list = get_holiday_list_for_employee(employee, raise_exception=raise_exception)
|
||||
|
||||
if not holiday_list:
|
||||
return []
|
||||
|
||||
filters = {
|
||||
'parent': holiday_list,
|
||||
'holiday_date': ('between', [start_date, end_date])
|
||||
}
|
||||
|
||||
if only_non_weekly:
|
||||
filters['weekly_off'] = False
|
||||
|
||||
holidays = frappe.get_all(
|
||||
'Holiday',
|
||||
fields=['description', 'holiday_date'],
|
||||
filters=filters
|
||||
)
|
||||
|
||||
return holidays
|
||||
|
||||
@erpnext.allow_regional
|
||||
|
||||
Reference in New Issue
Block a user