Skip to Content
Menu
This question has been flagged
2 Replies
3905 Views

Hi,

We have 4 type of Leaves (Annual, Sick, Lieu & Unpaid) and all of those are paid except the Unpaid leave. the issue is that Odoo normal behaviour is to deduct all leave from the number of working days which should not be the case so I am trying to create a salary rule to solve this;

result = ((contract.wage/26)*0.6)*(worked_days.WORK100.number_of_days+worked_days.Annual2015.number_of_days+worked_days.Lieu.number_of_days)

This works only if the employee has both the Annual2015 and the Lieu but wrong python code will come if none or either of the leave does not exist for that employee. So I am trying to build a salary rule deal with this as following however everything I try return Python error:

if (worked_days.Annual2015.number_of_days and inputs.worked_days.Lieu.number_of_days): 
result = (((contract.wage/26)*0.6)*worked_days.WORK100.number_of_days) elif (worked_days.Annual2015.number_of_days is None and worked_days.Lieu.number_of_days > 0): result = ((contract.wage/26)*0.6)*(worked_days.WORK100.number_of_days+worked_days.Lieu.number_of_days) elif (worked_days.Annual2015.number_of_days > 0 and worked_days.Lieu.number_of_days is None): result = ((contract.wage/26)*0.6)*(worked_days.WORK100.number_of_days+worked_days.Annual2015.number_of_days)

I appreciate your help on this.


Avatar
Discard

can you post the error msg ?

Author Best Answer

The error is: 

Wrong Python code defined on salary Rule Basic
Avatar
Discard
Related Posts Replies Views Activity
2
Dec 24
723
0
Jun 20
2666
0
Mar 15
2752
2
Mar 24
288
0
Mar 24
226