[FIX] web_kanban: correct count for dataset size

In non grouped mode, a recent fix (fixing race condition in do_search)
introduced a new bug, the dataset size is not correctly set.

This is a quick and dirty fix, I believe that changing the dataset
internals like this commit (and other) do is really not correct.
However, the correct fix (working on the dataset API) is more dangerous
in a stable release.
This commit is contained in:
Géry Debongnie
2016-04-15 11:47:49 +02:00
parent 053a4ab444
commit 9b54b042a0
@@ -138,6 +138,7 @@ var KanbanView = View.extend({
}));
} else {
new_ids = _.pluck(data.records, 'id');
self.dataset._length = data.count;
}
self.dataset.alter_ids(new_ids);
self.data = data;
@@ -157,17 +158,20 @@ var KanbanView = View.extend({
load_records: function (offset, dataset) {
dataset = dataset || this.dataset;
return dataset._model.query(this.fields_keys.concat(['__last_update']))
var query = dataset._model.query(this.fields_keys.concat(['__last_update']))
.limit(this.limit || false)
.offset(offset || 0)
.all()
.then(function (records) {
.offset(offset || 0);
return query.all()
.then(function (records) {
return query.count().then(function(count) {
return {
records: records,
is_empty: !records.length,
grouped: false,
count: count,
};
});
})
});
},
load_groups: function (options) {