Do not use set_text of Many2One and Reference when setting only string
changeset 13d81b52b4c4 replaced some direct call to wid_text.set_text by the set_text but it set_text on Reference expect to receive a tuple (from get_client). So when set_text is called just to clear or update the wid_text it loose the selection of Reference. Indeed as most of the time, it is called with an empty string, there is no need to set the position of the entry. issue8114 review54541002
This commit is contained in:
1 parent
4507ec63fd
commit
d0ddc163f4
2 files changed
+6
-6
No files matched your search
@@ -128,7 +128,7 @@ class Many2One(Widget):
|
||||
self.field.set_client(self.record,
|
||||
self.value_from_id(*result[0]), force_change=True)
|
||||
else:
|
||||
self.set_text('')
|
||||
self.wid_text.set_text('')
|
||||
self.focus_out = True
|
||||
self.changed = True
|
||||
|
||||
@@ -251,7 +251,7 @@ class Many2One(Widget):
|
||||
and editable
|
||||
and event.keyval in (gtk.keysyms.Delete,
|
||||
gtk.keysyms.BackSpace)):
|
||||
self.set_text('')
|
||||
self.wid_text.set_text('')
|
||||
return False
|
||||
|
||||
def sig_changed(self, *args):
|
||||
@@ -270,7 +270,7 @@ class Many2One(Widget):
|
||||
# in such case, the original text should not be restored
|
||||
if not self.wid_text.get_text():
|
||||
# Restore text and position after display
|
||||
self.set_text(text)
|
||||
self.wid_text.set_text(text)
|
||||
self.wid_text.set_position(position)
|
||||
gobject.idle_add(clean)
|
||||
return False
|
||||
@@ -281,7 +281,7 @@ class Many2One(Widget):
|
||||
def set_value(self):
|
||||
if self.field.get_client(self.record) != self.wid_text.get_text():
|
||||
self.field.set_client(self.record, self.value_from_id(None, ''))
|
||||
self.set_text('')
|
||||
self.wid_text.set_text('')
|
||||
|
||||
def set_text(self, value):
|
||||
if not value:
|
||||
@@ -297,7 +297,7 @@ class Many2One(Widget):
|
||||
self._set_completion()
|
||||
|
||||
if not self.field:
|
||||
self.set_text('')
|
||||
self.set_text(None)
|
||||
self.changed = True
|
||||
return False
|
||||
self.set_text(self.field.get_client(self.record))
|
||||
|
||||
@@ -126,7 +126,7 @@ class Reference(Many2One, SelectionMixin, PopdownMixin):
|
||||
if (model != self.get_model()
|
||||
or name != self.wid_text.get_text()):
|
||||
self.field.set_client(self.record, None)
|
||||
self.set_text('')
|
||||
self.set_text(None)
|
||||
|
||||
def set_text(self, value):
|
||||
if value:
|
||||
|
||||
Reference in new issue
Block a user