[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
This commit is contained in:
Nicolas Lempereur 2015-07-08 16:12:15 +02:00
parent 0511b9af83
commit a904645696
1 changed files with 5 additions and 5 deletions

View File

@ -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) {