跳至内容
菜单
此问题已终结
7 回复
3864 查看

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? 

形象
丢弃
最佳答案
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
形象
丢弃
编写者

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.

编写者

please reply me its urgent.

编写者

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.

编写者 最佳答案

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.

形象
丢弃
最佳答案

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

Any help?

形象
丢弃
相关帖文 回复 查看 活动
1
11月 23
2476
0
9月 18
3449
0
10月 17
10162
2
8月 17
7578
2
7月 24
10482