How a payslip is computed
A salary structure is a list of rules. Each rule has a category (Basic, Allowance, Deduction, Gross, Net), a sequence, an optional condition and an amount computed by a fixed value, a percentage or Python code. Rules run in sequence order, and later rules can use earlier results through categories and result_rules.
Overtime from attendance
With Attendance in use, overtime hours can reach the payslip as a worked-days line or as an input. A rule then multiplies hours by the hourly rate and your overtime factor:
# Overtime (category: Allowance)
hourly = contract.wage / 30 / 8
result = inputs['OT'].amount * hourly * 1.25 if 'OT' in inputs else 0
Use your own policy for the hourly base and the factor. Keep the formula readable; payroll staff should understand it.
Fixed and percentage allowances
- Fixed allowance stored on the contract, such as housing or transport, read in the rule.
- Percentage allowance computed from Basic with a percentage rule.
- Conditional allowance using the condition field, for example only for certain job positions.
Deductions
Absence deductions come from unpaid leave worked days; loans and advances come from inputs. Keep deductions in their own category so Net is simply Gross minus Deductions.
Test before the first live run
- Run payslips for one past month in parallel with your current payroll.
- Compare every employee's net pay and each component.
- Fix rules until every difference is explained, then go live.
Setting up Odoo Payroll? See Odoo Payroll and HR services.