From 8ebaad2cb5d83ee2215378bb82e58fd956252676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 7 Nov 2015 15:59:14 +0100 Subject: [PATCH] Fix compute exponent when value is int and factor Decimal Some Numeric Function field return integer instead of Decimal, so the test to convert to Decimal should be on the result of the factor multiplication instead of the value. issue5106 review16791003 --- tryton/gui/window/view_form/model/field.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 65e2e3c0f2..4a9e075097 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -327,8 +327,8 @@ class FloatField(Field): p = digits[1] else: d = value * factor - if not isinstance(value, Decimal): - d = Decimal(repr(value * factor)) + if not isinstance(d, Decimal): + d = Decimal(repr(d)) p = -int(d.as_tuple().exponent) return locale.format('%.*f', (p, value * factor), True) else: