[FIX] resource: oversights of previous forward-port

This commit is contained in:
Christophe Simonis
2018-06-28 21:50:23 +02:00
parent c8bb02141d
commit c302a90b6e
2 changed files with 15 additions and 16 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ def datetime_to_string(dt):
def float_to_time(hours):
""" Convert a number of hours into a time object. """
if float_hour == 24.0:
if hours == 24.0:
return time.max
fractional, integral = math.modf(hours)
return time(int(integral), int(60 * fractional), 0)
+14 -15
View File
@@ -184,21 +184,6 @@ class TestCalendar(TestResourceCommon):
leave.unlink()
# leave of very small size
def test_calendar_working_hours_24(self):
self.att_4 = self.env['resource.calendar.attendance'].create({
'name': 'Att4',
'calendar_id': self.calendar.id,
'dayofweek': '2',
'hour_from': 0,
'hour_to': 24
})
res = self.calendar.get_work_hours_count(
Datetime.from_string('2018-06-19 23:00:00'),
Datetime.from_string('2018-06-21 01:00:00'),
self.resource1_id,
compute_leaves=True)
self.assertAlmostEqual(res, 24.0)
leave = self.env['resource.calendar.leaves'].create({
'name': 'zero_length',
'calendar_id': self.calendar_patel.id,
@@ -239,6 +224,20 @@ class TestCalendar(TestResourceCommon):
leave.unlink()
def test_calendar_working_hours_24(self):
self.att_4 = self.env['resource.calendar.attendance'].create({
'name': 'Att4',
'calendar_id': self.calendar_jean.id,
'dayofweek': '2',
'hour_from': 0,
'hour_to': 24
})
res = self.calendar_jean.get_work_hours_count(
datetime_tz(2018, 6, 19, 23, 0, 0, tzinfo=self.jean.tz),
datetime_tz(2018, 6, 21, 1, 0, 0, tzinfo=self.jean.tz),
compute_leaves=True)
self.assertAlmostEqual(res, 24.0)
def test_plan_hours(self):
self.env['resource.calendar.leaves'].create({
'name': 'global',