Here's the COMM10 salary rule defined as python code and always true:
# Available variables:
#----------------------
# payslip: object containing the payslips
# employee: hr.employee object
# contract: hr.contract object
# rules: object containing the rules code (previously computed)
# categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).
# worked_days: object containing the computed worked days.
# inputs: object containing the computed inputs.
# Note: returned value have to be set in the variable 'result'
total_sale_amount = 0.0
sale_order_ids = sale_order_obj.search(cr, uid, [('user_id', '=', employee)], context=context)
for sale_order in sale_order_obj.browse(cr, uid, sale_order_ids, context=context):
total_sale_amount += sale_order.amount_total
print "total_sale_amount:: ", total_sale_amount
return total_sale_amount
result = total_sale_amount * 0.10
and this is the error reported:
ERROR ? openerp.netsvc: Error Wrong python code defined for salary rule Comm10 (COMM10)