1
votes

I need help to compile my payroll using the following python formula for OpenERP. Can someone please help me to write this properly for payroll please.

if categories.BASIC < 120:
    result = 0
elif categories.BASIC < 180:
    result = - categories.BASIC - 120 * 0.05
elif categories.BASIC < 264:
    result = - categories.BASIC - 180 * 0.1 + 3
elif categories.BASIC < 2136:
    result = - categories.BASIC - 264 * 0.175 + 11.4
else: categories.BASIC > 2400:
    result = - categories.BASIC - 2400 * 0.25 + 214.55

Kind Regards

1

1 Answers

0
votes

Don't for get to indent, python won't work without proper indentation.

if categories.BASIC < 120:
    result = 0
elif categories.BASIC < 180:
    result = categories.BASIC - 120 * 0.05
elif categories.BASIC < 264:
    result = categories.BASIC - 180 * 0.1 + 3
elif categories.BASIC < 2136:
    result = categories.BASIC - 264 * 0.175 + 11.4
elif categories.BASIC > 2400: #the else statement can't have a condition
    result = categories.BASIC - 2400 * 0.25 + 214.55