From a904645696efde111090aad6e06a76e745ed15c1 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 8 Jul 2015 16:12:15 +0200 Subject: [PATCH] [FIX] web_kanban: race when loading view_form When the view form is loaded passing by the kanban list, the kanban dataset data could be loaded after the view form is displayed. When going manually to the view form, the human is usually enough slow so the dataset ids are already loaded, but when loading directly the view form (for example an "Edit" link from a record on the website or a refresh) it can not be. For example on runbot the issue happened more or less 50% of the time, and on localhost 90% of the time. closes #7525 opw-642636 --- addons/web_kanban/static/src/js/kanban.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index c0d51f0cd5a..d125664d196 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -257,12 +257,12 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ self.fields_keys = _.unique(self.fields_keys.concat(grouping_fields)); } var grouping = new instance.web.Model(self.dataset.model, context, domain).query(self.fields_keys).group_by(grouping_fields); - return self.alive($.when(grouping)).done(function(groups) { + return self.alive($.when(grouping)).then(function(groups) { self.remove_no_result(); if (groups) { - self.do_process_groups(groups); + return self.do_process_groups(groups); } else { - self.do_process_dataset(); + return self.do_process_dataset(); } }); }); @@ -271,7 +271,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ var self = this; this.$el.find('table:first').show(); this.$el.removeClass('oe_kanban_ungrouped').addClass('oe_kanban_grouped'); - this.add_group_mutex.exec(function() { + return this.add_group_mutex.exec(function() { self.do_clear_groups(); self.dataset.ids = []; if (!groups.length) { @@ -310,7 +310,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ var self = this; this.$el.find('table:first').show(); this.$el.removeClass('oe_kanban_grouped').addClass('oe_kanban_ungrouped'); - this.add_group_mutex.exec(function() { + return this.add_group_mutex.exec(function() { var def = $.Deferred(); self.do_clear_groups(); self.dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }).done(function(records) {