diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js
index d325d558b96..9e8afe1629f 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -3864,11 +3864,13 @@ var BasicModel = AbstractModel.extend({
});
}
return $.when.apply($, defs).then(function () {
- // generate the res_ids of the main list, being the concatenation
- // of the fetched res_ids in each group
- list.res_ids = _.flatten(_.map(arguments, function (group) {
- return group ? group.res_ids : [];
- }));
+ if (!options || !options.onlyGroups) {
+ // generate the res_ids of the main list, being the concatenation
+ // of the fetched res_ids in each group
+ list.res_ids = _.flatten(_.map(arguments, function (group) {
+ return group ? group.res_ids : [];
+ }));
+ }
return list;
});
});
diff --git a/addons/web/static/src/js/views/kanban/kanban_model.js b/addons/web/static/src/js/views/kanban/kanban_model.js
index b12984dc876..08031e05dfe 100644
--- a/addons/web/static/src/js/views/kanban/kanban_model.js
+++ b/addons/web/static/src/js/views/kanban/kanban_model.js
@@ -358,6 +358,11 @@ var KanbanModel = BasicModel.extend({
*/
_reloadProgressBarGroupFromRecord: function (recordID, def) {
var element = this.localData[recordID];
+ if (element.type === 'list' && !element.parentID) {
+ // we are reloading the whole view, so there is no need to manually
+ // reload the progressbars
+ return def;
+ }
// If we updated a record, then we must potentially update columns'
// progressbars, so we need to load groups info again
diff --git a/addons/web/static/tests/views/kanban_tests.js b/addons/web/static/tests/views/kanban_tests.js
index b3bbc5ecb05..941c6c3f15e 100644
--- a/addons/web/static/tests/views/kanban_tests.js
+++ b/addons/web/static/tests/views/kanban_tests.js
@@ -2591,6 +2591,90 @@ QUnit.module('Views', {
kanban.destroy();
});
+ QUnit.test('kanban with progressbars: correctly update env when archiving records', function (assert) {
+ assert.expect(3);
+
+ // add active field on partner model and make all records active
+ this.data.partner.fields.active = {string: 'Active', type: 'char', default: true};
+
+ var kanban = createView({
+ View: KanbanView,
+ model: 'partner',
+ data: this.data,
+ arch:
+ '' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '
' +
+ '' +
+ '',
+ groupBy: ['bar'],
+ intercepts: {
+ env_updated: function (ev) {
+ assert.step(ev.data.ids);
+ },
+ },
+ });
+
+ // archive all records of the first column
+ kanban.$('.o_kanban_group:first .o_column_archive').click();
+
+ assert.verifySteps([
+ [1, 2, 3, 4],
+ [1, 2, 3],
+ ]);
+
+ kanban.destroy();
+ });
+
+ QUnit.test('RPCs when (re)loading kanban view progressbars', function (assert) {
+ assert.expect(9);
+
+ var kanban = createView({
+ View: KanbanView,
+ model: 'partner',
+ data: this.data,
+ arch:
+ '' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '
' +
+ '' +
+ '',
+ groupBy: ['bar'],
+ mockRPC: function (route, args) {
+ assert.step(args.method || route);
+ return this._super.apply(this, arguments);
+ },
+ });
+
+ kanban.reload();
+
+ assert.verifySteps([
+ // initial load
+ 'read_group',
+ '/web/dataset/search_read',
+ '/web/dataset/search_read',
+ 'read_progress_bar',
+ // reload
+ 'read_group',
+ '/web/dataset/search_read',
+ '/web/dataset/search_read',
+ 'read_progress_bar',
+ ]);
+
+ kanban.destroy();
+ });
+
QUnit.test('drag & drop records grouped by m2o with progressbar', function (assert) {
assert.expect(4);