From a86dfb803592fd77e87b9aabc047781e25ba1daf Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 7 Aug 2014 18:04:13 +0200 Subject: [PATCH] [FIX] web_kanban: in non-grouped kanban, on switch to form, display first record in view_form.js, in do_show method, if the dataset index is not set, the on_button_new method is triggered, opening a new record In regular kanbans (non-grouped kanban), the dataset index wasn't set, and, therefore, when switching to the view mode, it opened a form for a new record instead of opening the first record of the list, like this is the case for the view list and the grouped kanban --- addons/web_kanban/static/src/js/kanban.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index de263d381d9..b7cc68fbb82 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -288,6 +288,9 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ self.do_clear_groups(); self.dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }).done(function(records) { var kgroup = new instance.web_kanban.KanbanGroup(self, records, null, self.dataset); + if (!_.isEmpty(self.dataset.ids) && (self.dataset.index === null || self.dataset.index >= self.dataset.ids.length)) { + self.dataset.index = 0; + } self.do_add_groups([kgroup]).done(function() { if (_.isEmpty(records)) { self.no_result();