[FIX] resource: P3 rounding issue
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools import float_utils
|
||||
|
||||
|
||||
class ResourceMixin(models.AbstractModel):
|
||||
_name = "resource.mixin"
|
||||
@@ -46,7 +48,7 @@ class ResourceMixin(models.AbstractModel):
|
||||
theoric_hours = self.get_day_work_hours_count(day_intervals[0][0].date(), calendar=calendar)
|
||||
work_time = sum((interval[1] - interval[0] for interval in day_intervals), timedelta())
|
||||
total_work_time += work_time
|
||||
days_count += round((work_time.total_seconds() / 3600 / theoric_hours) * 4) / 4
|
||||
days_count += float_utils.round((work_time.total_seconds() / 3600 / theoric_hours) * 4) / 4
|
||||
return {
|
||||
'days': days_count,
|
||||
'hours': total_work_time.total_seconds() / 3600,
|
||||
@@ -69,7 +71,7 @@ class ResourceMixin(models.AbstractModel):
|
||||
for day_intervals in calendar._iter_leave_intervals(from_datetime, to_datetime, self.resource_id.id):
|
||||
theoric_hours = self.get_day_work_hours_count(day_intervals[0][0].date(), calendar=calendar)
|
||||
leave_time = sum((interval[1] - interval[0] for interval in day_intervals), timedelta())
|
||||
days_count += round((leave_time.total_seconds() / 3600 / theoric_hours) * 4) / 4
|
||||
days_count += float_utils.round((leave_time.total_seconds() / 3600 / theoric_hours) * 4) / 4
|
||||
return days_count
|
||||
|
||||
def iter_leaves(self, from_datetime, to_datetime, calendar=None):
|
||||
|
||||
Reference in New Issue
Block a user