Odoo Help

0

Conditional Python Code in Salary Rule of Payroll

By
Giovanny Vizcaya
on 12/19/14, 10:25 AM 3,381 views

Good Day

I'm testing the Payroll App, and i want to add a salary rule of Social Security of Venezuela, but i have a problem, this rule is based in minimum Wage = 4889.11 Bs.F, i mean, if an employee gains minimun wage and always give 4% to social security, for this i use the code

(((contract.wage * 12) / 52) * 0.04) * 2 
 

But if an employee gains more than minimun wage y have to do this code

((((4889.11 * 5) * 12) / 52) * 0.04) * 2

and about 0.04 is always the 4% from employees... the code applies for companies too but with a diference, in Venezuela there's 3 types of companies, low risk who gives 9% to social security using this code

(((contract.wage * 12) / 52) * 0.09) * 2

((((4889.11 * 5) * 12) / 52) * 0.09) * 2  Depending if employee gains more than minimun wage

other companies are medium risks and give 10 % and use the code

(((contract.wage * 12) / 52) * 0.10) * 2

((((4889.11 * 5) * 12) / 52) * 0.10) * 2  Depending if employee gains more than minimun wage

and there are companies with high risks and give 11% to social security

(((contract.wage * 12) / 52) * 0.11) * 2

((((4889.11 * 5) * 12) / 52) * 0.11) * 2  Depending if employee gains more than minimun wage

My Question is, How can i check the company's type (low, medium or high) and how can i check if employee gains minimum wage or more and obtain the value for this salary rule and apply the respective code?

Minimum wage is probably the contract.wage !

Med Said BARA
on 12/19/14, 10:53 AM

Thank you, i got the idea...based in your code, i used this if contract.wage

Giovanny Vizcaya
on 12/19/14, 12:11 PM
1

Med Said BARA

--Med Said BARA--
2694
| 5 5 7
Algeria
--Med Said BARA--
Med Said BARA
On 12/19/14, 12:02 PM

Let's call this rule IVSSEMPLOYEE. It should be computed as follow (this implies that all contract.wage are => 4889.11):

if contract.wage = 4889.11:
     result = (((contract.wage * 12) / 52) * 0.04) * 2 
elif 4889.11 < contract.wage <= 24455.55:
    result = ((((contract.wage * 5) * 12) / 52) * 0.04) * 2
else:
    result = ((((24455.55 * 5) * 12) / 52) * 0.04) * 2

Do you have any comment ?

Med Said BARA
on 12/19/14, 12:29 PM

24445.55 = The maximum contribution basis

Med Said BARA
on 12/20/14, 4:24 AM
0
Giovanny Vizcaya
On 12/19/14, 11:01 AM

no Med Said BARA, minimun wage in this country is 4889.11, sometimes an employee wins 4889.11, but other employees wins 6000 example:
Employee 1: contract.wage = 4889.11

Employee 2: contract.wage = 6000

i need to do a salary rule with python code that check if an employee wins 4889.11 or 6000 and apply the respective code.

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

3 follower(s)

Stats

Asked: 12/19/14, 10:25 AM
Seen: 3381 times
Last updated: 3/16/15, 8:10 AM