Hi Fam,
I am configuring payroll for my company, but I have a "small" issue with the setup for the PAYE Tax in the salary structure. the calculation for PAYE is defined by the Gross Salary as such:
Can someone help me to fix this as I keep getting an error:
Wrong python code defined for: - Employee: Ireana Gomesh -
Version: False -
Payslip: Salary Slip - Ireana Gomesh - February 2026 -
Salary rule: PAYE Tax (PAYE) -
Error: invalid syntax (, line 1)
Try this instead:
result = 0.0
# Access GROSS using its code
gross = payslip.get_rule_value('GROSS')
if gross <= 490:
result = 0.0 # No tax for salaries <= 490
else:
result = -25.0 # Flat tax amount
Alternative (if above doesn't work):
result = 0.0
# Direct calculation using same formula as GROSS
gross = categories.BASIC + categories.ALW
if gross <= 490:
result = 0.0
else:
result = -25.0
Also verify:
1. Your GROSS rule code field is exactly GROSS (case-sensitive)
2. PAYE rule sequence number is higher than GROSS rule
3. Both rules are in the same salary structure