mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 00:44:45 +00:00
* 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:
@@ -9,7 +9,7 @@ from frappe.utils import date_diff, getdate, rounded, add_days, cstr, cint, flt
|
||||
from frappe.model.document import Document
|
||||
from erpnext.payroll.doctype.payroll_period.payroll_period import get_payroll_period_days, get_period_factor
|
||||
from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_assigned_salary_structure
|
||||
from erpnext.hr.utils import get_sal_slip_total_benefit_given, get_holidays_for_employee, get_previous_claimed_amount, validate_active_employee
|
||||
from erpnext.hr.utils import get_sal_slip_total_benefit_given, get_holiday_dates_for_employee, get_previous_claimed_amount, validate_active_employee
|
||||
|
||||
class EmployeeBenefitApplication(Document):
|
||||
def validate(self):
|
||||
@@ -139,7 +139,7 @@ def get_max_benefits_remaining(employee, on_date, payroll_period):
|
||||
# Then the sum multiply with the no of lwp in that period
|
||||
# Include that amount to the prev_sal_slip_flexi_total to get the actual
|
||||
if have_depends_on_payment_days and per_day_amount_total > 0:
|
||||
holidays = get_holidays_for_employee(employee, payroll_period_obj.start_date, on_date)
|
||||
holidays = get_holiday_dates_for_employee(employee, payroll_period_obj.start_date, on_date)
|
||||
working_days = date_diff(on_date, payroll_period_obj.start_date) + 1
|
||||
leave_days = calculate_lwp(employee, payroll_period_obj.start_date, holidays, working_days)
|
||||
leave_days_amount = leave_days * per_day_amount_total
|
||||
|
||||
@@ -7,7 +7,7 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import date_diff, getdate, formatdate, cint, month_diff, flt, add_months
|
||||
from frappe.model.document import Document
|
||||
from erpnext.hr.utils import get_holidays_for_employee
|
||||
from erpnext.hr.utils import get_holiday_dates_for_employee
|
||||
|
||||
class PayrollPeriod(Document):
|
||||
def validate(self):
|
||||
@@ -65,7 +65,7 @@ def get_payroll_period_days(start_date, end_date, employee, company=None):
|
||||
actual_no_of_days = date_diff(getdate(payroll_period[0][2]), getdate(payroll_period[0][1])) + 1
|
||||
working_days = actual_no_of_days
|
||||
if not cint(frappe.db.get_value("Payroll Settings", None, "include_holidays_in_total_working_days")):
|
||||
holidays = get_holidays_for_employee(employee, getdate(payroll_period[0][1]), getdate(payroll_period[0][2]))
|
||||
holidays = get_holiday_dates_for_employee(employee, getdate(payroll_period[0][1]), getdate(payroll_period[0][2]))
|
||||
working_days -= len(holidays)
|
||||
return payroll_period[0][0], working_days, actual_no_of_days
|
||||
return False, False, False
|
||||
|
||||
@@ -11,6 +11,7 @@ from frappe.model.naming import make_autoname
|
||||
from frappe import msgprint, _
|
||||
from erpnext.payroll.doctype.payroll_entry.payroll_entry import get_start_end_dates
|
||||
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
|
||||
from erpnext.hr.utils import get_holiday_dates_for_employee
|
||||
from erpnext.utilities.transaction_base import TransactionBase
|
||||
from frappe.utils.background_jobs import enqueue
|
||||
from erpnext.payroll.doctype.additional_salary.additional_salary import get_additional_salaries
|
||||
@@ -337,20 +338,7 @@ class SalarySlip(TransactionBase):
|
||||
return payment_days
|
||||
|
||||
def get_holidays_for_employee(self, start_date, end_date):
|
||||
holiday_list = get_holiday_list_for_employee(self.employee)
|
||||
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]
|
||||
|
||||
return holidays
|
||||
return get_holiday_dates_for_employee(self.employee, start_date, end_date)
|
||||
|
||||
def calculate_lwp_or_ppl_based_on_leave_application(self, holidays, working_days):
|
||||
lwp = 0
|
||||
|
||||
Reference in New Issue
Block a user