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 add total number of days of current month in Salary Rule Python code ?

By
Raminder Pal Singh
on 7/3/13, 7:08 AM 3,407 views

I need to add total number of days of month (30 or 31) in a salary rule python code . How can i do that? result=-(contract.wage/30)*worked_days.Unpaid.number_of_days

2

Remya

--Remya--
5813
| 7 8 8
Thiruvananthapuram, India
--Remya--

Working as an Senior ODOO developer. http://in.linkedin.com/pub/remya-r/69/a23/298

Remya
On 7/12/13, 5:17 AM

image description

You want to create a working schedule for each employee.

Human resource->Contract->working schedule

Then automatically get the total no.of days for each employee.

Python code::::

datej = 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

How i can get the date differece in days in salary rule (not only for current month)? and how i can know about the days of month with date for example 28 days in Feb, 31 days in Jan etc.

waqar
on 1/28/14, 6:09 AM

I add this code to my salary rule. But while creating payslip, it shows 'python error'. Please correct me.

Rakhi sudevan
on 3/26/14, 7:27 AM
0
mostafa
On 9/9/14, 11:10 AM

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: 7/3/13, 7:08 AM
Seen: 3407 times
Last updated: 3/16/15, 8:10 AM