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.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 7/29/15, 4:33 PM|
|Seen: 567 times|
|Last updated: 7/30/15, 8:00 AM|