1

我需要帮助来使用以下用于 OpenERP 的 python 公式来编译我的工资单。有人可以帮我正确地写下工资单吗?

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

亲切的问候

4

1 回答 1

0

不要缩进,如果没有适当的缩进,python 将无法工作。

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
于 2013-03-22T16:05:15.840 回答