Introducing a new way to review your PRs.

Read the announcement

frappe / hrms

Open Source HR and Payroll Software

View on GitHub

20 documents · Updated Nov 23, 2026

docs / payroll-management

Payroll management

Payroll management turns compensation policy and employee work data into controlled pay results. It also carries tax, benefit, regional, accounting, payment, and employee statement needs through the same payroll period.

Payroll domain

The payroll domain gives the organization one path from a compensation decision to employee pay and related financial records. An employee's active assignment and local rules shape each result inside a company and a defined payroll period.

AreaPurpose
Compensation modelDefines earnings, deductions, employer costs, and benefit choices.
Pay inputsAdds recurring or one-time pay, incentives, other income, arrears, and corrections.
Pay cycleDefines the period, frequency, and employee group for a run.
Pay resultProduces an employee salary slip with gross pay, deductions, net pay, and cumulative values.
Statutory obligationsApplies tax slabs, exemptions, proof status, withholding, and required deductions.
BenefitsTracks benefit limits, claims, accruals, payouts, and remaining balances.
Accounting and paymentRecords payroll costs and settles the payroll liability.
Regional rulesAdds country-specific tax, benefit, and end-of-service behavior.
Reporting and statementsGives payroll users and employees views of pay and cost data.

The child pages describe these paths in more detail: Salary processing, Compensation, benefits, and tax, and Regional payroll.

References: hrms/…/payroll_onboarding.json• L20-46 hrms/…/payroll_entry.json• L57-334 hrms/…/payroll_settings.json• L37-201 hrms/…/payroll.json• L2-28

Payroll lifecycle

The payroll lifecycle starts with a salary structure and an effective employee assignment. It then uses a payroll period and approved work data to create pay results before it applies statutory and benefit effects and sends approved totals to accounting and payment.

The following diagram shows how a compensation decision becomes an employee statement and a company financial result.

flowchart LR
    A[Salary structure] --> B[Employee assignment]
    B --> C[Payroll period]
    C --> D[Payroll entry]
    D --> E[Salary slips]
    X[Pay inputs] --> E
    E --> F[Tax and benefit results]
    R[Regional rules] --> F
    R --> E
    E --> G[Accounting and payment]
    E --> H[Reports and pay statements]

The payroll entry is the company-level control point for a run. It selects eligible employees for a date range and frequency, checks attendance when required, and creates or submits salary slips. Larger runs can wait in a queue. The entry records failure and keeps cancellation tied to its salary and accounting records. Its form can derive the payroll period from the selected frequency and posting date, and it clears the selected employee set when period or scope fields change. The interface also refreshes the entry when queued salary-slip or overtime work completes, so the run state reflects background work. After salary slips are submitted, the run can create a bank entry or release withheld salaries when a payment account is available.

References: hrms/…/payroll_entry.py• L100-198 hrms/…/payroll_entry.py• L269-391 hrms/…/payroll_entry.py• L1302-1342 hrms/…/payroll_entry.js• L8-40 hrms/…/payroll_entry.js• L64-218 hrms/…/payroll_entry.js• L294-417 hrms/…/test_payroll_entry.py• L341-460

Compensation inputs

The compensation model defines how regular pay is built. A salary component represents an earning, deduction, or employer contribution. A salary structure groups those components with fixed values or rules, while a salary structure assignment connects the structure to an employee from an effective date.

The assignment holds employee-specific pay values, tax setup, benefit limits, cost centers, and payroll account choices. It evaluates the structure's earnings, deductions, and employer contributions in one shared full-cycle context, so dependent formulas can use earlier component values. Payroll can create assignments for a filtered employee group and skip employees who already have an assignment for that effective date.

The assignment also provides full-cycle gross earnings and total cost to company (CTC). Gross earnings exclude statistical and non-total earnings. CTC can include non-payable earnings, employer contributions, and regional employer costs. Timesheet wages remain period-specific inputs for the salary slip rather than part of the assignment's fixed component evaluation.

Period inputs extend the regular structure without changing the base policy:

  • Additional salary: Adds recurring or one-time earnings or deductions. It can replace a structure amount for a valid period.
  • Incentive and other income: Adds an incentive or income from another source to a payroll period.
  • Retention bonus: Records a future-dated bonus tied to an employee and a salary component.
  • Arrears and corrections: Carries earning, deduction, or accrual differences into a selected payroll date. A correction can also reverse leave without pay from an earlier salary slip.

The Compensation, benefits, and tax page explains these compensation and input rules in more detail.

References: hrms/…/salary_component.json• L50-296 hrms/…/salary_structure.json• L44-258 hrms/…/salary_structure_assignment.json• L43-268 hrms/…/salary_structure_assignment.py• L88-167 hrms/…/salary_structure_assignment.py• L240-354 hrms/…/salary_structure_assignment.py• L400-502 hrms/…/test_salary_structure_assignment.py• L38-145 hrms/…/test_salary_structure_assignment.py• L363-438 hrms/…/bulk_salary_structure_assignment.py• L40-141 hrms/…/additional_salary.json• L35-203 hrms/…/test_additional_salary.py• L19-313 hrms/…/arrear.json• L43-140 hrms/…/employee_incentive.json• L24-112 hrms/…/employee_other_income.json• L23-98 hrms/…/retention_bonus.json• L27-123 hrms/…/payroll_correction.json• L47-183

Pay calculation

Pay calculation evaluates the employee's assigned compensation for a payroll period. It combines payment days and work inputs with valid pay inputs, deductions, tax, benefits, and employer costs to produce the salary slip.

Payment days use the employee's active service dates and the selected leave or attendance records. Holiday lists affect working days. A half-day holiday counts as half a working day when holidays are excluded from the working-day total.

The domain supports regular frequency-based periods and timesheet-based pay. The assignment supplies period-independent structure values, while the salary slip supplies timesheet wages and applies payment-day proration. It can validate attendance before submission and can create or submit overtime slips for eligible employees. The Salary processing page covers the operational flow from payroll entry to salary slips, accounting, and payment.

The salary slip keeps period totals separate from cumulative values. It records gross pay, deductions, net pay, tax values, employer contributions, year-to-date values, and the links needed by later accounting and benefit work. When tax depends on payment days, a partial joining or relieving period contributes only its paid-day share to the current tax amount. A relieving period can still settle the remaining tax for the payroll year.

References: hrms/…/salary_slip.json• L224-326 hrms/…/salary_slip.json• L329-416 hrms/…/salary_slip.json• L486-690 hrms/…/salary_slip.py• L218-240 hrms/…/salary_slip.py• L545-648 hrms/…/salary_slip.py• L985-1055 hrms/…/salary_slip.py• L1130-1179 hrms/…/salary_slip.py• L1314-1321 hrms/…/salary_slip.py• L1980-2072 hrms/…/test_salary_slip.py• L933-1078 hrms/…/test_salary_slip.py• L2217-2278 hrms/…/salary_structure_assignment.py• L240-345 hrms/…/salary_structure_assignment.py• L400-502 hrms/…/test_salary_structure_assignment.py• L146-324 hrms/…/test_salary_structure_assignment.py• L440-496 hrms/…/payroll_settings.json• L37-115

Statutory obligations

Statutory obligations control taxable income and required deductions. Income tax slabs define effective bands, relief, exemptions, and other charges. Employee tax exemption categories define the allowed limits for declarations.

Employees can submit declarations and later provide proof for a payroll period. Payroll uses the declared or accepted exemption amount according to the tax slab and can deduct tax when proof is still missing. Duplicate declarations for one employee and period are not valid. The declaration form limits employee selection to active employees, limits payroll periods to the selected company, and offers a proof-submission action after the declaration is submitted. It also aligns the declaration currency with the employee's salary currency.

Payroll can also withhold salary for a set number of cycles. A withheld salary stays outside the normal bank settlement until it is released. The Compensation, benefits, and tax page explains the common tax flow. Country-specific behavior can extend it where local law differs.

References: hrms/…/income_tax_slab.json• L28-128 hrms/…/employee_tax_exemption_category.json• L16-34 hrms/…/employee_tax_exemption_sub_category.json• L17-46 hrms/…/employee_tax_exemption_declaration.json• L27-120 hrms/…/employee_tax_exemption_declaration.js• L4-75 hrms/…/test_employee_tax_exemption_declaration.py• L35-127 hrms/…/employee_tax_exemption_proof_submission.json• L31-149 hrms/…/salary_withholding.json• L31-180 hrms/…/payroll_entry.json• L145-149

Benefit administration

Benefit administration connects a benefit choice or claim to employee pay and to a balance for the payroll period. An employee benefit application records allowed choices and yearly limits. An employee benefit claim requests an eligible amount and can include expense proof.

The employee benefit ledger records accrual and payout movements. It links a movement to the employee, payroll period, salary slip, and source document when needed. This gives payroll a period-based view of what the employee has earned, used, and can still claim.

Salary slip submission keeps pay and benefit balances aligned. Accrual components can stay outside ordinary earnings until a payout is due. The Compensation, benefits, and tax page covers the benefit rules in more detail.

References: hrms/…/employee_benefit_application.json• L32-154 hrms/…/employee_benefit_claim.json• L28-138 hrms/…/employee_benefit_ledger.json• L26-137 hrms/…/salary_component.json• L122-143 hrms/…/salary_component.json• L243-296 hrms/…/salary_slip.py• L276-333

Regional rules

Regional payroll rules adapt the common payroll model to a country's legal and business needs. They can add local deductions, tax exemptions, employer costs, and end-of-service payments such as gratuity.

The shared payroll flow remains the base. Regional setup supplies local rules at the points where a common component or formula cannot express the required result. Salary structure assignments can add regional employer contributions to CTC, while salary slips apply regional employee deductions after ordinary deductions and add employer contributions before totals are finalised. The same regional behavior must affect both saved slips and previews. The Regional payroll page describes this boundary and its country-specific behavior.

Examples of regional concerns include:

  • Local statutory deduction types and employee identifiers.
  • Country-specific tax exemptions such as housing rent relief.
  • Gratuity rules based on service period, earnings, or contract conditions.

References: hrms/…/gratuity_rule.json• L24-96 hrms/…/gratuity.json• L34-199 hrms/…/salary_structure_assignment.py• L314-398 hrms/…/test_salary_structure_assignment.py• L80-119 hrms/…/salary_slip.py• L1004-1038 hrms/…/setup.py• L11-200 hrms/…/utils.py• L11-75

Accounting and payment

Approved payroll results create the company financial view of payroll. Earnings and deductions use component accounts and cost centers. Employer contributions use separate expense and liability accounts so employer cost does not become employee take-home pay.

The net payable amount is recorded against a payroll payable account. A bank or cash entry then settles that liability. Payroll can keep employee and cost-center detail and can carry currency and exchange-rate information when pay uses a different currency. The payroll entry form derives the company currency and default payroll payable account when the company changes. It also requires a payment account before creating payment entries.

Cancellation remains linked to the salary slips, journal entries, payment ledger entries, and benefit records created by the run. This link matters because payroll is both an employee transaction and a company financial transaction.

References: hrms/…/payroll_entry.json• L214-243 hrms/…/payroll_entry.py• L154-179 hrms/…/payroll_entry.py• L619-815 hrms/…/payroll_entry.py• L1092-1136 hrms/…/payroll_entry.py• L1196-1287 hrms/…/payroll_entry.js• L220-351 hrms/…/payroll_entry.js• L466-488 hrms/…/test_payroll_entry.py• L591-678 hrms/…/test_payroll_entry.py• L1118-1297

Reporting and pay statements

Payroll exposes approved period results through reports and employee-facing salary statements. The salary register gives a component view of salary slips and can include employer contributions. Payroll reports also support bank remittance, payment-mode review, tax review, accrued earnings, and employee cost-to-company views.

The salary payments based on payment mode report uses shared salary-slip deduction filters and marks branch total rows for clear review. Salary slips carry both current-period and cumulative values. Current print layouts present the employee, period, earnings, deductions, totals, and related payroll context in a form that employees can read.

The payroll dashboard and insights workbook summarize gross pay, net pay, deductions, employees paid, component totals, and department costs across recent periods and the fiscal year. The Salary processing page covers the operational reports. The Compensation, benefits, and tax page covers tax and benefit reports.

References: hrms/…/salary_register.py• L17-146 hrms/…/salary_register.py• L248-330 hrms/…/salary_payments_based_on_payment_mode.js• L5-16 hrms/…/income_tax_computation.json• L15-35 hrms/…/accrued_earnings_report.json• L5-33 hrms/…/bank_remittance.json• L7-24 hrms/…/employee_ctc_break_up.py• L13-83 hrms/…/salary_slip_classic.json• L6-34 hrms/…/salary_slip_detailed.json• L6-34 hrms/…/payroll.json• L2-54 hrms/…/payroll.json• L2-28

Payroll setup and oversight

Payroll onboarding presents the normal setup path for a new payroll domain. It starts with salary components, builds salary structures, assigns them to employees, and then runs a payroll entry. Additional salary and the salary register are optional follow-up steps.

The setup path is:

  1. Define salary components.
  2. Build salary structures.
  3. Assign structures and base pay to employees.
  4. Create a payroll entry for a period.
  5. Select eligible employees after the company, period, frequency, currency, and scope are set.
  6. Review the salary register and related dashboards.

References: hrms/…/payroll_onboarding.json• L20-46 hrms/…/create_salary_component.json• L2-20 hrms/…/create_salary_structure.json• L2-20 hrms/…/create_salary_structure_assignment.json• L2-20 hrms/…/create_payroll_entry.json• L2-20 hrms/…/view_salary_register.json• L2-23 hrms/…/payroll_entry.js• L135-156 hrms/…/payroll_entry.js• L234-291

Change checklist

When these files or sections are changed, remember to consider these:

  • A change to salary component flags can affect structures, assignments, formulas, tax, benefits, arrears, CTC, reports, and account mapping.
  • A change to assignment evaluation can affect full-cycle CTC, salary-slip proration, timesheet pay, cross-component formulas, regional employer costs, and the separation between fixed assignment values and period-specific wages.
  • A change to payroll periods or frequency can affect payment days, duplicate-slip checks, tax periods, benefit limits, withholding cycles, arrears, and reports.
  • A change to payroll-entry scope or employee selection must keep company, period, frequency, currency, account, and organizational filters aligned with the employees fetched for the run.
  • A change to payroll-entry background work must preserve the queued status refresh for salary-slip and overtime creation or submission, plus the retry path after failure.
  • A change to tax declarations or proof handling must keep active-employee selection, company-specific payroll periods, employee currency, category limits, period uniqueness, tax-slab use, and missing-proof deductions aligned.
  • A change to benefit payout or accrual behavior must preserve the link between the salary slip, payroll period, source document, and benefit ledger movement.
  • A change to regional hooks must keep previews, saved salary slips, CTC values, and local accounting results consistent.
  • A change to payroll submission, payment, queued work, or cancellation must preserve links to salary slips, journal entries, payment entries, payment ledger entries, and benefit records.
  • A change to print formats, reports, dashboards, or insights queries must preserve the meaning of current-period, cumulative, employer-cost, and company-currency totals.

Important failure modes

TriggerConsequenceGuard
Missing or conflicting effective salary assignmentPay has no clear compensation policy for the employee.Assignment validation checks dates, employee service dates, company, and duplicate submitted assignments.
Duplicate salary slip for one employee and date rangeThe employee can be paid twice for one cycle.Payroll entry and salary slip checks existing non-cancelled slips.
Missing payroll payable or component accountPayroll cannot create a valid accounting result.Payroll validates the payable account and checks component account setup before journal creation.
Invalid formula or conditionA component or full pay result cannot be evaluated.Formula validation and restricted evaluation report the affected component.
Missing full-cycle field or stale shared structure data during assignment evaluationCTC or component values can differ from the later salary slip or from another employee's run.Assignment evaluation seeds the full-cycle context, returns fresh rows, and keeps timesheet wages in the salary slip.
Unmarked attendance when validation is enabledThe run cannot be submitted with an unknown work record.Payroll entry checks active service dates, holiday ranges, and attendance before submission.
Missing tax exemption proof at the required pointTax is deducted without the expected exemption.Payroll entry and salary-slip tax settings can deduct tax for unsubmitted proof.
Duplicate declaration for one employee and payroll periodTax exemption input becomes ambiguous.Declaration validation rejects duplicate period entries and duplicate categories.
Inactive employee or wrong-company payroll period selected in a tax declarationThe declaration can use an invalid employee or period context.Form queries restrict employees to active status and payroll periods to the selected company.
Salary currency is not aligned with the employee's currencyTax declaration amounts can be interpreted in the wrong currency.The declaration form fetches the employee currency when the employee changes.
Salary withholding not releasedPay remains outside the normal bank settlement.Withholding cycles track the held period and release state.
Payment account is missing after salary-slip submissionPayroll cannot create the bank entry for settlement.The payroll entry requires a bank or cash payment account before payment creation.
Payment-day-dependent tax is not prorated for a partial periodA joining or relieving month can deduct too much or too little tax.Salary-slip tax calculation uses the paid-day share and settles remaining tax in the final period.
Unbalanced regional or employer contribution accountingCompany cost and liability records disagree.Regional contribution hooks and employer account mapping feed separate balanced entries.
Incomplete gratuity rule or payment routeEnd-of-service pay cannot be calculated or settled.Gratuity requires a rule and the fields for salary-slip or direct payment.

Key files

FileWhy to read it
hrms/…/payroll_entry.pyShows the pay-run control flow from employee selection through salary slips, accounting, payment, queueing, and cancellation.
hrms/…/payroll_entry.jsShows the run form's period and scope selection, employee fetching, background status updates, attendance review, retry actions, and payment actions.
hrms/…/salary_slip.pyShows the employee-level pay result, payment-day rules, tax and benefit links, regional extension points, and partial-period tax handling.
hrms/…/test_salary_slip.pyShows the business guarantees for payment days, leave and attendance, component conditions, and tax in joining and relieving periods.
hrms/…/salary_component.jsonShows the business meaning of earnings, deductions, employer contributions, tax, benefits, accruals, and formulas.
hrms/…/salary_structure.pyShows how a compensation policy is validated, assigned, previewed, and used for CTC.
hrms/…/salary_structure_assignment.pyShows how effective employee pay is evaluated across earnings, deductions, employer contributions, formulas, CTC, tax, benefits, cost centers, and regional extensions.
hrms/…/test_salary_structure_assignment.pyShows the guarantees for CTC boundaries, shared formula context, salary-slip fields, timesheet wages, old assignment dates, and submitted-assignment currency.
hrms/…/bulk_salary_structure_assignment.pyShows filtered and permission-aware assignment for employee groups.
hrms/…/additional_salary.jsonShows how recurring and one-time pay inputs enter a payroll period.
hrms/…/payroll_correction.jsonShows how prior salary results become arrears or leave-without-pay corrections.
hrms/…/employee_benefit_ledger.jsonShows the period-based record of benefit accruals and payouts.
hrms/…/employee_tax_exemption_declaration.jsonShows employee tax exemption input for a payroll period.
hrms/…/employee_tax_exemption_declaration.jsShows the valid employee and payroll-period context for a declaration, the proof handoff, and employee-currency alignment.
hrms/…/income_tax_slab.jsonShows the company and currency scope for tax slabs, relief, and exemptions.
hrms/…/gratuity_rule.jsonShows the service and earnings rules for gratuity.
hrms/…/gratuity.jsonShows the two end-of-service payment routes.
hrms/…/employee_ctc_break_up.pyShows how assigned compensation is presented as per-cycle and annual CTC.
hrms/…/salary_register.pyShows how approved salary slips become component and employer-cost reporting.
hrms/…/salary_payments_based_on_payment_mode.jsShows the payment-mode report filters and the visual treatment of branch totals.
hrms/…/payroll.jsonShows cross-period payroll measures for gross pay, net pay, deductions, and employees paid.
hrms/…/payroll_onboarding.jsonShows the intended first-time setup sequence for payroll.