Odoo Help

0

Conditional payroll calculation?

By
Adam McGill
on 11/5/13, 7:04 PM 1,861 views

I have a field in payroll where overtime can be entered into worked_days.number_of_hours. The entry is to field worked_days.OVERTIME.number_of_hours

I then have another field (Overtime Value) which uses python to value this overtime with the formula hourly_wage * worked_days.OVERTIME.number_of_hours

However, where a person does not work overtime there is no entry in worked_days.OVERTIME.number_of_days and the field for Overtime Value errors out.

How can I put a condition into the Overtime Value field that says to ignore this calculation if the user has not placed a value in worked_days.OVERTIME.number_of_hours?

Many thanks for your assistance.

0
omar bajunaid
On 6/15/14, 10:00 AM

in salary rule python condition input the following;

result = worked_days.OVERTIME and worked_days.OVERTIME.number_of_hours or False

also try

result = worked_days.OVERTIME and worked_days.OVERTIME.number_of_days or False

hope this helps 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 11/5/13, 7:04 PM
Seen: 1861 times
Last updated: 3/16/15, 8:10 AM