Payroll Entry override
Purpose
Section titled “Purpose”Explain how Payroll Entry differs from stock HRMS when validating employees and building the salary run.
Scope in codebase
Section titled “Scope in codebase”leekimerp/leekimerp/override/custom_payroll_entry.py- Class:
CustomPayrollEntry(PayrollEntry)(seehooks.pyoverride_doctype_class)
Methods
Section titled “Methods”| Method | Behavior |
|---|---|
validate_employee_details | If 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_list | Builds 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]Configuration
Section titled “Configuration”- Custom flag
is_not_a_main_salary_slipon Payroll Entry (when set, skips duplicate-slip enforcement and payrolled-employee removal per code paths) — confirm field definition on your site.
Dependencies
Section titled “Dependencies”hrms.payroll.doctype.payroll_entry.payroll_entrybase class; module-level helpersget_filter_condition,get_sal_struct,get_emp_list,remove_payrolled_employeesin same file
Operational notes
Section titled “Operational notes”- Multiple salary slips per month per company: logic branch with
is_not_a_main_salary_slip— document business rules for finance users.
Related
Section titled “Related”- Payroll & HR, Doc events for Payroll Entry validate hooks