From 5dfd3a9d7c8646820b960f44c91bee2423c1cb61 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Fri, 14 Apr 2017 13:52:09 +0200 Subject: [PATCH] [FIX] web: List: archive record The method `update_state` doesn't exist anymore and has been replaced by `update`. --- .../src/js/views/list/list_controller.js | 2 +- addons/web/static/tests/views/list_tests.js | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/js/views/list/list_controller.js index 5dcc2300eac..94c38a62376 100644 --- a/addons/web/static/src/js/views/list/list_controller.js +++ b/addons/web/static/src/js/views/list/list_controller.js @@ -155,7 +155,7 @@ var ListController = BasicController.extend({ } return this.model .toggleActive(ids, !archive, this.handle) - .then(this.update_state.bind(this)); + .then(this.update.bind(this, {}, {reload: false})); }, /** * This function is the hook called by the field manager mixin to confirm diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 20a92efbcb2..28944aeebfd 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -527,6 +527,39 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('archiving one record', function (assert) { + assert.expect(9); + + // add active field on foo model and make all records active + this.data.foo.fields.active = {string: 'Active', type: 'boolean', default: true}; + + var list = createView({ + View: ListView, + model: 'foo', + data: this.data, + viewOptions: {sidebar: true}, + arch: '', + mockRPC: function (route) { + assert.step(route); + return this._super.apply(this, arguments); + }, + }); + + assert.ok(list.sidebar.$el.hasClass('o_hidden'), 'sidebar should be invisible'); + assert.strictEqual(list.$('tbody td.o_list_record_selector').length, 4, "should have 4 records"); + + list.$('tbody td.o_list_record_selector:first input').click(); + + assert.ok(!list.sidebar.$el.hasClass('o_hidden'), 'sidebar should be visible'); + + assert.verifySteps(['/web/dataset/search_read']); + list.sidebar.$('a:contains(Archive)').click(); + + assert.strictEqual(list.$('tbody td.o_list_record_selector').length, 3, "should have 3 records"); + assert.verifySteps(['/web/dataset/search_read', '/web/dataset/call_kw/foo/write', '/web/dataset/search_read']); + list.destroy(); + }); + QUnit.test('pager (ungrouped and grouped mode), default limit', function (assert) { assert.expect(4);