Reviewers: ,


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

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


Index: tryton/gui/window/view_form/view/screen_container.py
===================================================================

--- a/tryton/gui/window/view_form/view/screen_container.py
+++ b/tryton/gui/window/view_form/view/screen_container.py
@@ -80,6 +80,7 @@
         self.alternate_view = False
         self.search_window = None
         self.search_table = None
+        self.last_search_text = ''
         self.tab_domain = tab_domain or []

         tooltips = common.Tooltips()
@@ -411,6 +412,7 @@
                 if value:
                     text += label + ' ' + value + ' '
             self.set_text(text)
+            self.last_search_text = self.get_text()
             self.do_search()

         def date_activate(entry):
@@ -533,6 +535,21 @@
             if page and self.search_window not in page.dialogs:
                 page.dialogs.append(self.search_window)
             self.search_window.show()
+
+            if self.last_search_text.strip() != self.get_text().strip():
+                for label, entry in self.search_table.fields:
+                    if isinstance(entry, gtk.ComboBox):
+                        entry.set_active(-1)
+                    elif isinstance(entry, Dates):
+                        entry.from_.set_text('')
+                        entry.to.set_text('')
+                    elif isinstance(entry, Selection):
+                        entry.treeview.get_selection().unselect_all()
+                    else:
+                        entry.set_text('')
+                if self.search_table.fields:
+                    self.search_table.fields[0][1].grab_focus()
+
         else:
             self.search_window.hide()
             if page and self.search_window in page.dialogs:



--
--
[email protected] mailing list

--- You received this message because you are subscribed to the Google Groups "tryton-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to