Server scripts — Sales Invoice & payroll
Purpose
Section titled “Purpose”Map scripts/ entry points to hooks so engineers know where submit-time and payroll logic lives.
Scope in codebase
Section titled “Scope in codebase”leekimerp/leekimerp/scripts/sales_invoice.pyleekimerp/leekimerp/scripts/salary_slip.py,payroll_entry.py,salary_component.py,employee.py(see Payroll & HR and Doc events)
Sales Invoice (scripts/sales_invoice.py)
Section titled “Sales Invoice (scripts/sales_invoice.py)”| Symbol | Trigger | Role |
|---|---|---|
before_submit_sales_invoice | doc_events Sales Invoice on_update in hooks.py | Expands [Year], [Invoice No], [Customer], [Item Code] in item description lines via _render_template |
Flow: On update, each item description is scanned; known bracket tokens are replaced from the invoice and row context.
Payroll scripts (summary)
Section titled “Payroll scripts (summary)”| Module | Notable hooks |
|---|---|
salary_slip.py | CPF, SHG, SDL, net pay (chained on Salary Slip validate) |
payroll_entry.py | Naming, salary structure switch, trash handler |
salary_component.py | Abbreviations, accounts table |
employee.py | Salary structure v2, holiday list |
Details: Doc events, Payroll module.
Dependencies
Section titled “Dependencies”- ERPNext HRMS payroll DocTypes
- Company and account setup per Accounting hooks on Account / Company