[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
This commit is contained in:
Denis Ledoux 2014-08-07 18:04:13 +02:00
parent b9c4bb6b6c
commit a86dfb8035
1 changed files with 3 additions and 0 deletions

View File

@ -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();