Moien U Deen Let's talk

Writing Odoo salary rules for overtime, allowances and deductions

Odoo Payroll calculates a payslip by running salary rules in sequence. Once you understand worked days, inputs and categories, overtime and allowances become a few clear rules. This is how I set them up, as for CBM in the UAE.

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

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

  1. Run payslips for one past month in parallel with your current payroll.
  2. Compare every employee's net pay and each component.
  3. Fix rules until every difference is explained, then go live.

Setting up Odoo Payroll? See Odoo Payroll and HR services.

Need help with this in your Odoo?

Tell me how your business runs today. I start with requirements before suggesting any setup.

Message me on WhatsApp