[FIX] resource: avoid floating point error in interval
bzr revid: mat@openerp.com-20130507094035-rtbyzukv4shpx024
This commit is contained in:
@@ -128,7 +128,8 @@ class resource_calendar(osv.osv):
|
||||
d2 = datetime(dt_from.year, dt_from.month, dt_from.day, int(math.floor(m)), int((m%1) * 60))
|
||||
result.append((d1, d2))
|
||||
current_hour = hour_from
|
||||
todo -= (m-hour_from)
|
||||
# avoid float point error with round
|
||||
todo = round(todo - (hour_to - m), 4)
|
||||
dt_from -= timedelta(days=1)
|
||||
current_hour = 24
|
||||
maxrecur -= 1
|
||||
@@ -180,7 +181,8 @@ class resource_calendar(osv.osv):
|
||||
d2 = datetime(dt_from.year, dt_from.month, dt_from.day, int(math.floor(hour_to)), int((hour_to%1) * 60))
|
||||
result.append((d1, d2))
|
||||
current_hour = hour_to
|
||||
todo -= (hour_to - m)
|
||||
# avoid float point error with round
|
||||
todo = round(todo - (hour_to - m), 4)
|
||||
dt_from += timedelta(days=1)
|
||||
current_hour = 0
|
||||
maxrecur -= 1
|
||||
|
||||
Reference in New Issue
Block a user