Don't restore text on many2one cleaning if not empty

The call to set_client in clean function could trigger a on_change that will
set a value to the current field. In such case, the previous text should not be
restored.

issue4238
review5701002
This commit is contained in:
Cédric Krier committed 2014-10-10 10:05:09 +02:00
1 parent f095bb4eb6
commit 6df542f08d
1 file changed
+6 -3
@@ -257,9 +257,12 @@ class Many2One(Widget):
position = self.wid_text.get_position()
self.field.set_client(self.record,
self.value_from_id(None, ''))
# Restore text and position after display
self.wid_text.set_text(text)
self.wid_text.set_position(position)
# The value of the field could be different of None
# in such case, the original text should not be restored
if not self.wid_text.get_text():
# Restore text and position after display
self.wid_text.set_text(text)
self.wid_text.set_position(position)
gobject.idle_add(clean)
return False