Payroll & HR
Purpose
Section titled “Purpose”Document the custom payroll pipeline built on ERPNext HR/Payroll DocTypes with Singapore-specific calculations.
Scope in codebase
Section titled “Scope in codebase”leekimerp/leekimerp/scripts/salary_slip.py,salary_component.py,payroll_entry.py,employee.pyleekimerp/leekimerp/hook_methods.pyhooks.py—doc_eventsfor Employee, Salary Slip, Payroll Entry, Salary Component- Reports: see Reports catalog (payroll-related: Payroll Report, CPF Payment Advice, Monthly Payroll Summary Report, Employee-Payslip Report, etc.)
Key DocTypes
Section titled “Key DocTypes”- Employee, Salary Slip, Payroll Entry, Salary Component, Company, Account
Validation chain (Salary Slip)
Section titled “Validation chain (Salary Slip)”flowchart LR A[Salary Slip validate] --> B[setup_payment_days] B --> C[setup_pay_items] C --> D[calculate_cpf_v2] D --> E[calculate_shg] E --> F[calculate_sdl] F --> G[recalculate_net_pay] G --> H[payroll_entry.append_salary_slip]Entry points
Section titled “Entry points”- Desk: Standard Payroll Entry and Salary Slip workflows
- Hooks:
validatechains on Salary Slip; Employeevalidate/after_insertfor structures and holiday list
Function / method list (representative hooks)
Section titled “Function / method list (representative hooks)”| Handler | Type | Role |
|---|---|---|
setup_payment_days | script | Payment days |
setup_pay_items | script | Earnings/deductions |
calculate_cpf_v2 | script | CPF |
calculate_shg | script | SHG |
calculate_sdl | script | SDL |
recalculate_net_pay | script | Net pay |
append_salary_slip | script | Tie to payroll entry |
Dependencies
Section titled “Dependencies”- Chart of accounts and salary component setup per company
Configuration
Section titled “Configuration”- Lee Kim Payroll Settings, Singapore Payroll Settings (and related DocTypes as present in the app)
Operational notes
Section titled “Operational notes”- Payroll Entry naming and trash handling — see
scripts/payroll_entry.pyon_trash
Known gaps
Section titled “Known gaps”- Mid-month hire proration and other edge cases may need manual adjustment (track as product backlog).
Related
Section titled “Related”- Reports catalog — Lee Kim custom reports (payroll, tax, Xero AR, etc.)
- Server scripts —
scripts/modules and Sales Invoice templating - Payroll Entry override —
CustomPayrollEntryduplicate-slip and employee list logic