From 2a0c018043ddcc40074bb46e63bce46f191d459d Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 19 Mar 2015 14:15:33 +0100 Subject: [PATCH] [FIX] kanban: search more when DataSetStatic When showing a kanban, there is differences between dataset of types: * DataSetStatic: self.view.dataset===self.dataset, their ids attributes are the entire ids list, * DataSet and DataSetSearch: self.view.dataset.ids are the already in the view ids, self.dataset.ids are the last gotten ids. Hence with DataSetStatic dataset, when self.view.dataset.ids.splice(0) is done self.dataset.ids is also emptied. And in the read_slice function, the slice is done on that (now empty) array. This fix removes the splicing of this ids array (which doesn't change a thing since the array is overwritten latter), a _.difference is used to remove eventual duplicates since in the DataSetStatic case, the same array is being concatenated to itself opw-630654 opw-617090 opw-619563 --- addons/web_kanban/static/src/js/kanban.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index bdc0d539d25..60e7f1e6585 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -649,12 +649,12 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({ }, do_show_more: function(evt) { var self = this; - var ids = self.view.dataset.ids.splice(0); + var ids = self.view.dataset.ids.slice(0); return this.dataset.read_slice(this.view.fields_keys.concat(['__last_update']), { 'limit': self.view.limit, 'offset': self.dataset_offset += self.view.limit }).then(function(records) { - self.view.dataset.ids = ids.concat(self.dataset.ids); + self.view.dataset.ids = ids.concat(_.difference(self.dataset.ids, ids)); self.do_add_records(records); self.compute_cards_auto_height(); self.view.postprocess_m2m_tags();