From 5a2e57fd9637762bd965dd22566da097616fc093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 14 Nov 2023 00:53:52 +0100 Subject: [PATCH] Convert float to string before Decimal To avoid rounding issue of float, we must rely on the Python string format. Closes #12738 --HG-- branch : 6.0 --- tryton/tryton/common/number_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/tryton/common/number_entry.py b/tryton/tryton/common/number_entry.py index c6eb228ef2..91a52aa011 100644 --- a/tryton/tryton/common/number_entry.py +++ b/tryton/tryton/common/number_entry.py @@ -53,7 +53,7 @@ class NumberEntry(Gtk.Entry, Gtk.Editable): value = None if text not in ['-', self.__decimal_point]: try: - value = Decimal(locale.atof(text)) + value = Decimal(str(locale.atof(text))) except (ValueError, InvalidOperation): return position if (value and self.__digits is not None