Skip to content
Permalink
Browse files

[FIX] base: float_time

- Record a timesheet entry of '00:14'
  => it is correctly saved as 0.23333...
- Select the entry, and print 'Timesheet Entries'

The tmesheet appears as '00:13'.

This is because `minutes` is equal to `13.99999999999998`, which is
truncated to `13` at formatting.

A simple call to `round` is enough to prevent this.

opw-1969149
  • Loading branch information...
nim-odoo committed Apr 19, 2019
1 parent e7ce0b4 commit 4e99af93f935f30e065ad0055e639fd20fa0d1d3
Showing with 1 addition and 1 deletion.
  1. +1 −1 odoo/addons/base/ir/ir_qweb/fields.py
@@ -370,7 +370,7 @@ class FloatTimeConverter(models.AbstractModel):
def value_to_html(self, value, options):
sign = math.copysign(1.0, value)
hours, minutes = divmod(abs(value) * 60, 60)
return '%02d:%02d' % (sign * hours, minutes)
return '%02d:%02d' % (sign * hours, round(minutes))


class DurationConverter(models.AbstractModel):

0 comments on commit 4e99af9

Please sign in to comment.
You can’t perform that action at this time.