Reviewers: ,


Please review this at http://codereview.tryton.org/404002/

Affected files:
  M tryton/gui/window/view_form/view/form_gtk/one2many.py


Index: tryton/gui/window/view_form/view/form_gtk/one2many.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/one2many.py
+++ b/tryton/gui/window/view_form/view/form_gtk/one2many.py
@@ -32,6 +32,7 @@

         tooltips = common.Tooltips()

+        self.focus_out = True
         if attrs.get('add_remove'):

             self.wid_text = gtk.Entry()
@@ -310,6 +311,8 @@
             self._sig_add()

     def _sig_add(self, *args):
+        if not self.focus_out:
+            return
         access = common.MODELACCESS[self.screen.model_name]
         if not access['write'] or not access['read']:
             return
@@ -320,6 +323,7 @@
         domain.extend(self.record.expr_eval(self.attrs.get('add_remove')))
         removed_ids = self.field.get_removed_ids(self.record)

+        self.focus_out = False
         try:
             if self.wid_text.get_text():
                 dom = [('rec_name', 'ilike',
@@ -330,9 +334,11 @@
ids = RPCExecute('model', self.attrs['relation'], 'search', dom,
                     0, CONFIG['client.limit'], None, context=context)
         except RPCException:
+            self.focus_out = True
             return False

         def callback(result):
+            self.focus_out = True
             if result:
                 ids = [x[0] for x in result]
                 self.screen.load(ids, modified=True)



--
[email protected] mailing list

Reply via email to