diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js index 858a8eaed8b..4c2eed53e18 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -72,6 +72,7 @@ var ListRenderer = BasicRenderer.extend({ */ updateState: function (state, params) { this._processColumns(params.columnInvisibleFields || {}); + this.selection = []; return this._super.apply(this, arguments); }, diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 2fafef26c6f..970a895719d 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -582,6 +582,40 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('selection is reset on reload', function (assert) { + assert.expect(5); + + var list = createView({ + View: ListView, + model: 'foo', + data: this.data, + arch: '' + + '' + + '' + + '', + }); + + assert.strictEqual(list.$('tfoot td:nth(2)').text(), '32', + "total should be 32 (no record selected)"); + + // select first record + var $firstRowSelector = list.$('tbody .o_list_record_selector input').first(); + $firstRowSelector.click(); + assert.ok($firstRowSelector.is(':checked'), "first row should be selected"); + assert.strictEqual(list.$('tfoot td:nth(2)').text(), '10', + "total should be 10 (first record selected)"); + + // reload + list.reload(); + $firstRowSelector = list.$('tbody .o_list_record_selector input').first(); + assert.notOk($firstRowSelector.is(':checked'), + "first row should no longer be selected"); + assert.strictEqual(list.$('tfoot td:nth(2)').text(), '32', + "total should be 32 (no more record selected)"); + + list.destroy(); + }); + QUnit.test('aggregates are computed correctly', function (assert) { assert.expect(4);