Skip to Content
Menu
This question has been flagged
21 Replies
33148 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..

Avatar
Discard
Best Answer

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

Avatar
Discard

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 you can use unpaid for unpaid leave and put salary rule for it (you can put more than one salary rule as you want)

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

Author

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).

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 -

yes employess with unpaid leave run succesfully..

then add condition I have Edit my answer

Author

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

Author

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

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

@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

Author

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

Author

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

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

Author

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

Author

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

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

Best Answer

its worked but if leave less than day in payslip compute as 1 day

Avatar
Discard
Best Answer

Half pay leave this worked 

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

Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
Mar 15
5106
16
Nov 23
21566
12
Dec 23
30465
0
Jul 15
5844
0
Mar 15
3243