From 689382daeba0ff3ecec5d1b505cb6e5eee823909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 31 Oct 2023 21:42:11 +0100 Subject: [PATCH] Do not fail when parsing invalid Decimal value in number entry Closes #12692 --- tryton/tryton/common/number_entry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tryton/tryton/common/number_entry.py b/tryton/tryton/common/number_entry.py index 5df9cd89ad..4aeee1955d 100644 --- a/tryton/tryton/common/number_entry.py +++ b/tryton/tryton/common/number_entry.py @@ -2,7 +2,7 @@ # this repository contains the full copyright notices and license terms. import gettext import locale -from decimal import Decimal +from decimal import Decimal, InvalidOperation from gi.repository import Gdk, GObject, Gtk @@ -62,7 +62,7 @@ class NumberEntry(Gtk.Entry, Gtk.Editable): if text not in ['-', self.__decimal_point, self.__thousands_sep]: try: value = Decimal(locale.delocalize(text, self.monetary)) - except ValueError: + except (ValueError, InvalidOperation): return position if (value and self.__digits is not None and (round(value, self.__digits) != value