Skip to content

Payroll Entry override

Explain how Payroll Entry differs from stock HRMS when validating employees and building the salary run.

  • leekimerp/leekimerp/override/custom_payroll_entry.py
  • Class: CustomPayrollEntry(PayrollEntry) (see hooks.py override_doctype_class)
MethodBehavior
validate_employee_detailsIf not is_not_a_main_salary_slip, throws if a submitted Salary Slip already exists for the same employee and period (start_date / end_date).
get_emp_listBuilds SQL filters (company, branch, department, designation, salary structure, payroll payable account). If not is_not_a_main_salary_slip, calls remove_payrolled_employees to exclude employees already payrolled in the period.
flowchart TD
V[validate_employee_details] --> C{Salary Slip exists for period?}
C -->|yes| E[frappe.throw]
C -->|no| OK[Continue]
G[get_emp_list] --> F[Filters + salary structure]
F --> R[remove_payrolled_employees unless flag]
  • Custom flag is_not_a_main_salary_slip on Payroll Entry (when set, skips duplicate-slip enforcement and payrolled-employee removal per code paths) — confirm field definition on your site.
  • hrms.payroll.doctype.payroll_entry.payroll_entry base class; module-level helpers get_filter_condition, get_sal_struct, get_emp_list, remove_payrolled_employees in same file
  • Multiple salary slips per month per company: logic branch with is_not_a_main_salary_slip — document business rules for finance users.