Reviewers: ,


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

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


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

--- a/tryton/gui/window/view_form/view/list.py
+++ b/tryton/gui/window/view_form/view/list.py
@@ -709,12 +709,21 @@
                 and self.widget_tree.editable \
                 and not self.screen.parent \
                 and previous_record != self.screen.current_record:
-            if previous_record and \
-                    not (previous_record.validate(self.get_fields())
-                            and previous_record.save()):
-                self.screen.current_record = previous_record
-                self.set_cursor()
-                return True
+            if previous_record:
+                def go_previous():
+                    self.screen.current_record = previous_record
+                    self.set_cursor()
+
+                def save():
+                    if not previous_record.destroyed:
+                        if not previous_record.save():
+                            go_previous()
+
+                if not previous_record.validate(self.get_fields()):
+                    go_previous()
+                    return True
+                # Delay the save to let GTK process the current event
+                gobject.idle_add(save)
         self.update_children()

     def set_value(self):



--
[email protected] mailing list

Reply via email to