[FIX] optimization necessary in some cases when kanban views can take more that 10 seconds to load

bzr revid: nicolas.vanhoren@openerp.com-20130430094843-9m1629m517vjtm1o
This commit is contained in:
niv-openerp 2013-04-30 11:48:43 +02:00
parent 6970e5e041
commit 7c160b8a72
1 changed files with 5 additions and 2 deletions

View File

@ -259,10 +259,13 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
var remaining = groups.length - 1,
groups_array = [];
return $.when.apply(null, _.map(groups, function (group, index) {
var def = $.when([]);
var dataset = new instance.web.DataSetSearch(self, self.dataset.model,
new instance.web.CompoundContext(self.dataset.get_context(), group.model.context()), group.model.domain());
return dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit })
.then(function(records) {
if (group.attributes.length >= 1) {
def = dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit });
}
return def.then(function(records) {
self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset);
if (!remaining--) {