diff --git a/tryton/gui/window/view_form/view/form_gtk/float.py b/tryton/gui/window/view_form/view/form_gtk/float.py index 4d4d9d808e..442a8cfcce 100644 --- a/tryton/gui/window/view_form/view/form_gtk/float.py +++ b/tryton/gui/window/view_form/view/form_gtk/float.py @@ -30,6 +30,8 @@ class Float(Integer): position = entry.get_position() new_value = value[:position] + new_text + value[position:] try: + if new_value == '-': + return if len(str(int(locale.atof(new_value)))) > self.digits[0]: entry.stop_emission('insert-text') except: diff --git a/tryton/gui/window/view_form/view/form_gtk/integer.py b/tryton/gui/window/view_form/view/form_gtk/integer.py index 32fbd1e8fb..9b17039df1 100644 --- a/tryton/gui/window/view_form/view/form_gtk/integer.py +++ b/tryton/gui/window/view_form/view/form_gtk/integer.py @@ -31,6 +31,8 @@ class Integer(Char): position = entry.get_position() new_value = value[:position] + new_text + value[position:] try: + if new_value == '-': + return locale.atoi(new_value) except: entry.stop_emission('insert-text')