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

leaves and salary calculation.

By
charlesraj
on 6/14/13, 4:52 AM 9,398 views

hi. Any one please tell me how to reduce the salary of an employee who take leave.

eg: salary=5000

he/she take one leave in a month , then reduce rs.100 from his salary. Ie then remaining salary is 4900.How to configure this in openerp v7.0.

i assigned a salary rule (Deduction Towards Leave Availed) to salary structure.

there is a field for adding python code in this rule. how to implement my need through python code. please help..

3
Maath
On 6/16/13, 4:28 AM

Hi

You need to add salary rule to salary structure to deduct (add python code)

result=-(contract.wage/30)*worked_days.Unpaid.number_of_days

then you can deduct from salary depending on number of Unpaid leave taken by employee

and you need to put the condition for this rule (Not Always True )

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

Regards

I have 4 types of leaves(Sick,legal,casual,unpaid). how can i generalize this? Did i want to create 4 separate salary rule?

Remya
on 6/17/13, 2:07 AM

@Remya you can use unpaid for unpaid leave and put salary rule for it (you can put more than one salary rule as you want)

Maath
on 6/17/13, 3:34 AM

@charlesaj first you should installed holiday model and have leave (named unpaid )

Maath
on 6/17/13, 3:42 AM

hi.. that error conditions occured at i calculate the payslip for employee who did n't take leave. The error is like. Error!

Wrong python code defined for salary rule Deduction Towards Leave Availed (DLA).

charlesraj
on 6/17/13, 4:33 AM

OK , But when Employee have unpaid leave will work successfully ,you just need condition to the salary rule (Not Always True ) (the condition will check if employee have leave then apply salary rule else don't do anything ) -I have edit my answer vote up and select as correct answer if solved your problem -

Maath
on 6/17/13, 4:46 AM

yes employess with unpaid leave run succesfully..

Remya
on 6/17/13, 5:15 AM

then add condition I have Edit my answer

Maath
on 6/17/13, 5:18 AM

ok now the problem is ok.. for employees without have leaves.. inorder to calculate the salary deduction(for leave days) from it i use "result= (contract.wage)*worked_days.Unpaid and worked_days.Unpaid.number_of_days or False". This will return the error. any way to implement it..

charlesraj
on 6/17/13, 7:22 AM

sorry i use result= (contract.wage/30)*worked_days.Unpaid and worked_days.Unpaid.number_of_days or False

charlesraj
on 6/17/13, 7:24 AM

Same thing can be done for Half Day leaves also. You have to create leave type as half day and use the same code (replace unpaid with half day) and divide by 2

Raminder Pal Singh
on 6/17/13, 7:46 AM

@charlesraj use the code in my answer please and tell me what the problem you need 1- salary rule 2- condition for this salary rule

Maath
on 6/17/13, 8:02 AM

sir i need to calculate the deduction for the leave days..ie. Now for one unpaid leave 1 is reduced from the net salary . But i want to deduce the total salary of particular leave day from the net salary..

charlesraj
on 6/17/13, 8:10 AM

condition for the salary rule.. Deduct the salary(days which employee take leaves) from the net salary .

charlesraj
on 6/17/13, 8:13 AM

do not understand , the deduction should be from Basic salary my dear , other deduction you can put it as input (by value or do code for it) hope that help you

Maath
on 6/17/13, 8:20 AM

i want to put code in the salary rule. now i applied your code. it make the deduction of salary for the number of leave taken. ie: what i say is If He/She take one leave ONE will be deduced from the net salary..

charlesraj
on 6/17/13, 8:41 AM

Thank sir it work for me....i will add like this....result=-(worked_days.Unpaid and worked_days.Unpaid.number_of_days*(contract.wage/30)) or False ...

charlesraj
on 6/17/13, 8:52 AM

I added same rule and condition but it will not affecting on calculation of payslip amounts and so on....even that rule is not appearing on Payslip form view after clicked on compute sheet

Vaibhav
on 7/30/13, 10:39 AM
0
Aby
On 10/8/15, 5:31 AM

Half pay leave this worked 

result=(worked_days.Halfpaidsickleave and worked_days.Halfpaidsickleave.number_of_days*(contract.wage/30)/2) or False

0
trinath
On 5/21/14, 3:22 AM

S MY SELF TOO NO EFECT OVER IT.. IN COMPUTATIO FOLKS!!

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

1 follower(s)

Stats

Asked: 6/14/13, 4:52 AM
Seen: 9398 times
Last updated: 10/8/15, 6:03 AM