changeset a5b56699a0d2 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=a5b56699a0d2
description:
        Avoid display in switch_view when creating new record

        The display in switch_view is useless as a second call is made after 
setting
        the new record.

        issue8539
        review267711002
diffstat:

 tryton/gui/window/view_form/screen/screen.py |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (35 lines):

diff -r 7dc88cf0b5be -r a5b56699a0d2 
tryton/gui/window/view_form/screen/screen.py
--- a/tryton/gui/window/view_form/screen/screen.py      Sun Aug 18 18:51:54 
2019 +0200
+++ b/tryton/gui/window/view_form/screen/screen.py      Sun Aug 18 18:57:30 
2019 +0200
@@ -484,7 +484,7 @@
     def number_of_views(self):
         return len(self.views) + len(self.view_to_load)
 
-    def switch_view(self, view_type=None, view_id=None):
+    def switch_view(self, view_type=None, view_id=None, display=True):
         if view_id is not None:
             view_id = int(view_id)
         if self.current_view:
@@ -526,9 +526,10 @@
             if view_type and not view_id and not len(self.view_to_load):
                 break
         self.screen_container.set(self.current_view.widget)
-        self.display()
-        # Postpone set of the cursor to ensure widgets are allocated
-        GLib.idle_add(self.set_cursor)
+        if display:
+            self.display()
+            # Postpone set of the cursor to ensure widgets are allocated
+            GLib.idle_add(self.set_cursor)
 
     def load_view_to_load(self):
         if len(self.view_to_load):
@@ -588,7 +589,7 @@
         if self.current_view.view_type == 'calendar':
             selected_date = self.current_view.get_selected_date()
         if self.current_view and not self.current_view.editable:
-            self.switch_view('form')
+            self.switch_view('form', display=False)
             if self.current_view.view_type != 'form':
                 return None
         if self.current_record:

Reply via email to