Skip to Content
Menu
This question has been flagged
7 Replies
3756 Views

Hello,

When I take leave request for 1 day. it show 1 day properly on leave details but on payslip number of days display 1.13.

working time is 9 hours. also checking hr.holidays in postgresql number of days is 1. but don't understand on payslip how it take 1.13.I am using odoo v10. after taking working time is 8 hours there is no issue. why this happen? 

hr_payroll.py

leaves = [value for key, value in leaves.items()]
for data in [attendances] + leaves:
    data['number_of_days'] = uom_hour._compute_quantity(data['number_of_hours'], uom_day)\
        if uom_day and uom_hour\
        else data['number_of_hours'] / 8.0

    res.append(data)

also explain bold lines.



any help? 

Avatar
Discard
Best Answer
Hello,

Please set your timezone in your currently logged in user as per your region and add the leave and count the payroll again to resolve this issue.

data['number_of_days'] = uom_hour._compute_quantity(data['number_of_hours'], uom_day)\
        if uom_day and uom_hour\
        else data['number_of_hours'] / 8.0

This is a condition to convert the hours to days. Due to factor ration in hours is 8, it will affect the hours over 8 hrs.

This will execute as :

if uom_day and uom_hour:
    data['number_of_days'] = uom_hour._compute_quantity(data['number_of_hours'], uom_day)
else:
    data['number_of_days'] =  data['number_of_hours'] / 8.0

So if uom_hour and uom_day, then it will convert the hours to days,
otherwise it will directly divide the hours by 8.

Hope it will work for you,
Thanks
Avatar
Discard
Author

For 8 hours working time there is no issue. if I take 9 hours or 10 hours working time then data['number_of_days'] = 1.13 or data['number_of_days'] = 1.25 which means data['numbers_of_hours'] is divided by 8 not 9 or 10. then should I change code or any other solution.

Author

please reply me its urgent.

Author

After setting timezone in currently logged in user as per my region still not working..

Ok, Please check the Rounding Precision for Day(s) and Hour(s) Unit of Measure, Hope you have not added any customisation for Unit of Measure. If it's urgent and you want to change the code, then you can directly divide the number of days by your working time.

Author Best Answer

Thanks @Malay B Khamar for your answer and time. your solution useful for me. I understand factor ratio is 8 hence I got data['number_of_days'] = 1.13 or data['number_of_days'] = 1.25 for working time 9 or 10. on changing factor ratio 9 or 10 work for me.

Avatar
Discard
Best Answer

Hey how did you get this working?  When i change hr_payroll.py to divide by 9.0 nothing happens?

Any help?

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 23
2257
0
Sep 18
3247
0
Oct 17
9977
2
Aug 17
7414
2
Jul 24
10280