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.

1

Unpaid Leaves Deduction not working

By
Maath
on 5/11/13, 5:43 AM 5,932 views

I have creating salary rule for unpaid leave for the following code "result=-(contract.wage/31)*worked_days.Unpaid.number_of_days" is working but it is get me error when employee have no Unpaid Leaves is there is condition or some thing to solve this problem ,

5
Maath
On 5/11/13, 5:46 AM

Finally I found the solution .. the condition needed for this rule

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

and then working correctly

the following link help in this problem

http://help.openerp.com/question/14645/unpaid-leaves-is-not-decrease-in-the-salary-computation/#14782

@Maath Deduction amount is not posibble it is adding...

sridhar
on 5/11/13, 6:13 AM

@sridhar you can make it deduction or adding depending on Salary rule Category and - signal in rule "result=-(contract.wage/31)*worked_days.Unpaid.number_of_days" Now it is working successfully for me any problems with you?

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

result=worked_days.Unpaid and worked_days.Unpaid.number_of_days or False this concept adding the loss of pay amount.

sridhar
on 5/11/13, 6:22 AM

No, this is a condition for apply the rule will not be Always True , choose python code and put this condition

Maath
on 5/11/13, 6:29 AM

@Maath Yes Maath now it is working perfectly thank you very much...

sridhar
on 5/11/13, 6:34 AM

i put 1 vote for u

sridhar
on 5/11/13, 6:38 AM

This work for me as well. Thanks for the solution @maath . Hats off to you.

Raminder Pal Singh
on 5/11/13, 4:39 PM

@maath : Can we remove 31 with the number of days of the month for which we are calculating the payslip.Do u know the code for that?

Raminder Pal Singh
on 5/12/13, 5:30 AM

Hello Anybody can me tell me how to calculate Overtime in OPenrp

Atul Kumar jain
on 11/26/14, 2:03 AM
1
Raminder Pal Singh
On 7/1/13, 3:43 AM

has anyone got the solution , how can we remove 31 with the number of days of the month for which we are calculating the payslip ??

This is not answer for question .... when you need to ask a question should put it in new question or comment in the question if you want ..

Maath
on 7/1/13, 9:46 AM

Sorry for inconvenience, did intentionally to seek attention of the followers of this question.May be i got the answer from them. If u insist ,i may delete this.

Raminder Pal Singh
on 7/1/13, 10:07 AM

No , you are free

Maath
on 7/6/13, 8:18 AM
0
nishad
On 12/23/15, 6:47 AM

Keep a new field "month" in hr_payslip model and on saving the record it should be updated as follows,

month = dt.strptime(date_from,'%Y-%m-%d').month

res['value'].update({'month': month})

--------------------------------------
We are using the above month variable to index the days in a month which is given as a list,

result=(contract.wage/[0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] [payslip.month])*worked_days.Unpaid and worked_days.Unpaid.number_of_days or False

0
Shahid M
On 12/16/15, 9:01 AM

# Get the no of days ...........

atej = str(payslip.date_to)

datek = str(payslip.date_from)

dj = datej[-2:]

x=0

new = 0

while (x<=31):

x= x+1

if str(x) == dj or "0"+str(x) == dj:

new= x

dk = datek[-2:]

y=0

old = 0

while (y<=31):

y= y+1

if str(y) == dk or "0"+str(y) == dk:

old= y

no_of_days = new-old + 1

result = no_of_days

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

0 follower(s)

Stats

Asked: 5/11/13, 5:43 AM
Seen: 5932 times
Last updated: 12/29/15, 4:39 AM