From a218a9ed3f6c965820f2ebdf76ee0e6c89c59a0c Mon Sep 17 00:00:00 2001
From: Denis Ledoux <dle@odoo.com>
Date: Thu, 18 Sep 2014 15:50:59 +0200
Subject: [PATCH] [FIX] kanban: wrong condition to reset the dataset index

The dataset index should be reset either if the dataset is empty or the index is greater than the records size
---
 addons/web_kanban/static/src/js/kanban.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js
index 63bfc769e14b..a0d163565172 100644
--- a/addons/web_kanban/static/src/js/kanban.js
+++ b/addons/web_kanban/static/src/js/kanban.js
@@ -272,8 +272,10 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
                 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--) {
+                        if (self.dataset.index >= records.length){
                             self.dataset.index = self.dataset.size() ? 0 : null;
+                        }
+                        if (!remaining--) {
                             return self.do_add_groups(groups_array);
                         }
                 });
-- 
GitLab