changeset 95afb03bd50c in tryton:5.2
details: https://hg.tryton.org/tryton?cmd=changeset;node=95afb03bd50c
description:
        Do not test NumericEntry digits for non numeric values

        issue8532
        review285861002
        (grafted from 57355dea2a7b69ee57aa7a7d30c30d9424cfdd83)
diffstat:

 tryton/common/number_entry.py |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (22 lines):

diff -r 8bc875e4ea89 -r 95afb03bd50c tryton/common/number_entry.py
--- a/tryton/common/number_entry.py     Sun Sep 01 23:37:55 2019 +0200
+++ b/tryton/common/number_entry.py     Fri Aug 30 08:59:18 2019 +0200
@@ -49,14 +49,14 @@
         buffer_ = self.get_buffer()
         text = self.get_buffer().get_text()
         text = text[:position] + new_text + text[position:]
-        if text in ['-', self.__decimal_point]:
-            pass
-        else:
+        value = None
+        if text not in ['-', self.__decimal_point]:
             try:
                 value = locale.atof(text)
             except ValueError:
                 return position
-        if self.__digits is not None and round(value, self.__digits) != value:
+        if (value and self.__digits is not None
+                and round(value, self.__digits) != value):
             return position
         buffer_.insert_text(position, new_text, length)
         return position + length

Reply via email to