Reviewers: ,
Please review this at http://codereview.tryton.org/144001/
Affected files:
M tryton/gui/window/view_form/view/form_gtk/many2one.py
M tryton/gui/window/view_form/view/form_gtk/reference.py
Index: tryton/gui/window/view_form/view/form_gtk/many2one.py
===================================================================
--- a/tryton/gui/window/view_form/view/form_gtk/many2one.py
+++ b/tryton/gui/window/view_form/view/form_gtk/many2one.py
@@ -250,12 +250,14 @@
super(Many2One, self).display(record, field)
if not field:
self.wid_text.set_text('')
+ self.wid_text.set_position(0)
self.changed = True
return False
img = self.but_open.get_image()
current_stock = img.get_stock()[0]
- res = field.get_client(record)
- self.wid_text.set_text((res and str(res)) or '')
+ res = field.get_client(record) or ''
+ self.wid_text.set_text(res)
+ self.wid_text.set_position(len(res))
if res and current_stock != 'tryton-open':
img.set_from_stock('tryton-open', gtk.ICON_SIZE_SMALL_TOOLBAR)
self.tooltips.set_tip(self.but_open, _('Open a record'))
Index: tryton/gui/window/view_form/view/form_gtk/reference.py
===================================================================
--- a/tryton/gui/window/view_form/view/form_gtk/reference.py
+++ b/tryton/gui/window/view_form/view/form_gtk/reference.py
@@ -250,6 +250,7 @@
if not self.changed:
return
self.wid_text.set_text('')
+ self.wid_text.set_position(0)
self.field.set_client(self.record, (self.get_model(), (-1, '')))
def sig_changed(self, *args):
@@ -270,6 +271,7 @@
self.changed = False
if not field:
child.set_text('')
+ child.set_position(0)
self.changed =True
return False
super(Reference, self).display(record, field)
@@ -281,7 +283,9 @@
model, (obj_id, name) = value
if model:
child.set_text(self._selection2[model])
+ child.set_position(len(self._selection2[model]))
self.wid_text.set_text(name)
+ self.wid_text.set_position(len(name))
if obj_id:
img.set_from_stock('tryton-open',
gtk.ICON_SIZE_SMALL_TOOLBAR)
self.but_open.set_image(img)
@@ -290,7 +294,9 @@
self.but_open.set_image(img)
else:
child.set_text('')
+ child.set_position(0)
self.wid_text.set_text(str(name))
+ self.wid_text.set_position(len(str(name)))
img.set_from_stock('tryton-find', gtk.ICON_SIZE_SMALL_TOOLBAR)
self.but_open.set_image(img)
self.changed = True
--
[email protected] mailing list