[FIX] resource: increase the rounding factor in resource_mixin

In order to be more precise in the number of hours shown in leaves, we
need more precision in resource_mixin

closes odoo/odoo#28907
This commit is contained in:
RomainLibert
2018-11-21 13:04:55 +00:00
parent a874760d41
commit 1d28525d6b
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -8,8 +8,8 @@ from pytz import utc
from odoo import api, fields, models
from odoo.tools import float_utils
# This will generate eights of days
ROUNDING_FACTOR = 8
# This will generate 16th of days
ROUNDING_FACTOR = 16
class ResourceMixin(models.AbstractModel):
+3 -3
View File
@@ -351,7 +351,7 @@ class TestResMixin(TestResourceCommon):
datetime_tz(2018, 4, 2, 0, 0, 0, tzinfo=self.jean.tz),
datetime_tz(2018, 4, 6, 23, 0, 0, tzinfo=self.jean.tz),
)
self.assertEqual(data, {'days': 1.375, 'hours': 13})
self.assertEqual(data, {'days': 1.4375, 'hours': 13})
# Viewing it as Patel
# Views from 2018/04/01 11:00:00 to 2018/04/06 10:00:00
@@ -359,7 +359,7 @@ class TestResMixin(TestResourceCommon):
datetime_tz(2018, 4, 2, 0, 0, 0, tzinfo=self.patel.tz),
datetime_tz(2018, 4, 6, 23, 0, 0, tzinfo=self.patel.tz),
)
self.assertEqual(data, {'days': 1.125, 'hours': 10})
self.assertEqual(data, {'days': 1.1875, 'hours': 10})
# Viewing it as John
data = self.john.get_work_days_data(
@@ -505,7 +505,7 @@ class TestResMixin(TestResourceCommon):
datetime_tz(2018, 4, 9, 0, 0, 0, tzinfo=self.john.tz),
datetime_tz(2018, 4, 13, 23, 59, 59, tzinfo=self.john.tz),
)
self.assertEqual(data, {'days': 1, 'hours': 10})
self.assertEqual(data, {'days': 0.9375, 'hours': 10})
# half days
leave = self.env['resource.calendar.leaves'].create({