Odoo Help

Welcome!

This community 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.

0

How to enable this Python condition statement in a salary rule?

By
Pascal Tremblay
on 12/20/14, 1:21 PM 1,633 views

I don't understand. Even if the GROSS of the employee is 437.50 $, my condition always return 222...  Weird.

if categories.GROSS == 1000:

    result=15.30

elif categories.GROSS == 437.50:

   result=6.69

else:

   result=222

idea?

See example :

1

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 12/20/14, 2:11 PM

May be a problem of rounding. You are comparing floats. Be better:

if abs(categories.GROSS-1000)<0.0001:

 

BIG THANKS!!!

Pascal Tremblay
on 12/20/14, 2:24 PM
0

Med Said BARA

--Med Said BARA--
2664
| 5 5 7
Algeria
--Med Said BARA--
Med Said BARA
On 12/20/14, 2:13 PM

It seems that ther is a confusion between the Category "GROSS" and the rule "GROSS" !

Usually, categories.GROSS means the sum of all rules which belong to this category. Do you have any of such rules ?

Look under:Salary Rule Categories Hierarchy

--added after question modification---

I started to edit my answer before you edit your question (I did not see the added image).

My response remains valid.

I suppose that the related rule is AE, in this case just replace categories.GROSS by GROSS.

 

Thanks a lot for your time. I have this category. I have corrected the post.

Pascal Tremblay
on 12/20/14, 2:25 PM

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 12/20/14, 1:21 PM
Seen: 1633 times
Last updated: 3/16/15, 8:10 AM