diff --git a/tryton/gui/window/view_form/widget_search/checkbox.py b/tryton/gui/window/view_form/widget_search/checkbox.py index 78c18335eb..8975ad5510 100644 --- a/tryton/gui/window/view_form/widget_search/checkbox.py +++ b/tryton/gui/window/view_form/widget_search/checkbox.py @@ -27,7 +27,13 @@ class CheckBox(Interface): return [] def _value_set(self, value): - pass + if value == '': + self.widget.child.set_text('') + return + if value: + self.widget.child.set_text(_('Yes')) + else: + self.widget.child.set_text(_('No')) value = property(_value_get, _value_set, None, _('The content of the widget or ValueError if not valid')) diff --git a/tryton/gui/window/view_form/widget_search/float.py b/tryton/gui/window/view_form/widget_search/float.py index 11a979455d..d210ff64a8 100644 --- a/tryton/gui/window/view_form/widget_search/float.py +++ b/tryton/gui/window/view_form/widget_search/float.py @@ -24,16 +24,19 @@ class Float(Integer): return self._get_clause(value1, value2) def _value_set(self, value): - self.entry1.set_text(locale.format('%.' + str(self.digits[1]) + 'f', - value or 0.0, True)) - self.entry2.set_text(locale.format('%.' + str(self.digits[1]) + 'f', - value or 0.0, True)) + if value == False: + text = '' + else: + text = locale.format('%.' + str(self.digits[1]) + 'f', + value or 0.0, True) + self.entry1.set_text(text) + self.entry2.set_text(text) value = property(_value_get, _value_set, None, _('The content of the widget or ValueError if not valid')) def clear(self): - self.value = 0.0 + self.value = False def sig_insert_text(self, widget, new_text, new_text_length, position): value = widget.get_text() diff --git a/tryton/gui/window/view_form/widget_search/integer.py b/tryton/gui/window/view_form/widget_search/integer.py index 895f4ffb98..0aa2dd7acf 100644 --- a/tryton/gui/window/view_form/widget_search/integer.py +++ b/tryton/gui/window/view_form/widget_search/integer.py @@ -55,14 +55,18 @@ class Integer(Interface): return res def _value_set(self, value): - self.entry1.set_text(locale.format('%d', value or 0, True)) - self.entry2.set_text(locale.format('%d', value or 0, True)) + if value == False: + text = '' + else: + text = locale.format('%d', value or 0, True) + self.entry1.set_text(text) + self.entry2.set_text(text) value = property(_value_get, _value_set, None, _('The content of the widget or ValueError if not valid')) def clear(self): - self.value = 0 + self.value = False def sig_activate(self, fct): self.entry1.connect_after('activate', fct) diff --git a/tryton/gui/window/view_form/widget_search/selection.py b/tryton/gui/window/view_form/widget_search/selection.py index 44f055c2bb..093b7ddf88 100644 --- a/tryton/gui/window/view_form/widget_search/selection.py +++ b/tryton/gui/window/view_form/widget_search/selection.py @@ -62,13 +62,15 @@ class Selection(Interface): def _value_set(self, value): if value == False: - value = '' - for sel in self._selection: - if self._selection[sel] == value: - self.widget.child.set_text(sel) + self.widget.child.set_text('') + return + for long_text, sel_value in self._selection.items(): + if sel_value == value: + self.widget.child.set_text(long_text) + break def clear(self): - self.value = '' + self.value = False value = property(_value_get, _value_set, None, 'The content of the widget or ValueError if not valid')