[FIX] base: qweb float_time widget negative value

When trying to convert -1.5 into a time format, instead
of displaying -1:30, the widget will show -2:30, which
is confusing. The float time qweb widget does not handle
correclty negative, when its javascript version works
correclty.
This commit fixes this problem.
This commit is contained in:
jem-odoo
2018-05-04 13:22:04 +02:00
parent 851f36f3d0
commit a3372ffa33
+3 -2
View File
@@ -355,8 +355,9 @@ class FloatTimeConverter(models.AbstractModel):
@api.model
def value_to_html(self, value, options):
hours, minutes = divmod(value * 60, 60)
return '%02d:%02d' % (hours, minutes)
factor = -1 if value < 0 else 1
hours, minutes = divmod(abs(value) * 60, 60)
return '%02d:%02d' % (hours * factor, minutes)
class DurationConverter(models.AbstractModel):