# Salary calculation on the basis of days the employees worked

By
Vijay M Nayani
on 11/28/13, 8:20 AM 8,989 views

I want to calculate the salary of the employees based on the number of days they worked. For eg if an employee works for 25 days, his salary for 5 days needs to eb deducted from his basic salary. how to do it??

Mohan
on 8/31/16, 2:43 AM
Mohan
On 8/26/16, 5:55 AM

Change the Salary Rules/Basic Code -

The code is,

result = 0

for line in payslip.worked_days_line_ids:

result += line.number_of_days

if result >= 28:

result = 30

result = result*(contract.wage/30)

Note:

Go to the Salary Rules ---> Basic ---> Under the Computation ---> Click the Python Code option ---> Replace the New Code

Thanks & Regards,

Mohanraj J

(SrikeshInfotech)

Mike Telahun
On 11/29/13, 7:20 AM

Create a salary that multiplies the daily/hourly rate by the number of worked days/hours For example, assuming you have 26 working days in a month:

result = worked_days.WORK100.number_of_days * (contract.wage / 26)

for slip in self.browse(cu, uid, ids, context=None): NameError: global name 'cu' is not defined

praveen
on 4/3/14, 8:49 AM

you should put "cr" not "cu"

Yassine TEIMI
on 7/9/15, 3:02 PM
inian
On 6/6/16, 2:59 AM

How to calculate hours based salary for employee?

Mohan
on 6/16/17, 3:55 AM
Vijay M Nayani
On 11/29/13, 3:33 AM

Hi I am also looking for the same .....................

praveen
on 4/3/14, 8:49 AM
Mohan
on 6/16/17, 3:55 AM

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.

### Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

4 follower(s)

### Stats

 Asked: 11/28/13, 8:20 AM Seen: 8989 times Last updated: 5/6/17, 3:59 AM