Reviewers: ,

Description:
tryton: readonly test for next_column should depend if editable or not

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

Affected files:
  M tryton/gui/window/view_form/view/list.py
  M tryton/gui/window/view_form/view/list_gtk/editabletree.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
@@ -859,7 +859,7 @@
             path = self.store.on_get_path(self.screen.current_record)
             if self.store.get_flags() & gtk.TREE_MODEL_LIST_ONLY:
                 path = (path[0],)
-            focus_column = self.widget_tree.next_column(path)
+            focus_column = self.widget_tree.next_column(path, editable=new)
             if path[:-1]:
                 self.widget_tree.expand_to_path(path[:-1])
             self.widget_tree.scroll_to_cell(path, focus_column,
Index: tryton/gui/window/view_form/view/list_gtk/editabletree.py
===================================================================
--- a/tryton/gui/window/view_form/view/list_gtk/editabletree.py
+++ b/tryton/gui/window/view_form/view/list_gtk/editabletree.py
@@ -18,7 +18,7 @@
         super(TreeView, self).__init__()
         self.cells = {}

-    def next_column(self, path, column=None, _sign=1):
+    def next_column(self, path, column=None, editable=True, _sign=1):
         columns = self.get_columns()
         if column is None:
             column = columns[-1 * _sign]
@@ -34,13 +34,17 @@
             field = record[column.name]
             field.state_set(record, states=('readonly', 'invisible'))
invisible = field.get_state_attrs(record).get('invisible', False)
-            readonly = field.get_state_attrs(record).get('readonly', False)
+            if editable:
+ readonly = field.get_state_attrs(record).get('readonly', False)
+            else:
+                readonly = False
             if not (invisible or readonly):
                 break
         return column

-    def prev_column(self, path, column=None):
-        return self.next_column(path, column=column, _sign=-1)
+    def prev_column(self, path, column=None, editable=True):
+        return self.next_column(path, column=column, editable=editable,
+            _sign=-1)


 class EditableTreeView(TreeView):


Reply via email to