From b8c4b42250b9caf2ac4fef32cc85dab05ccc3b08 Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Mon, 3 Dec 2018 11:05:52 +0000 Subject: [IMP] web: state_selection widget readonly if field readonly The current implementation of the state_selection widget always makes it editable even if the field is readonly. We improved this behavior by removing the handle of click on the widget when the field is readonly, but keeping it even if the view is not in edit mode, because it used for example in project to change state even when view is not editable. closes odoo/odoo#29218 --- .../web/static/tests/fields/basic_fields_tests.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'addons/web/static/tests/fields/basic_fields_tests.js') diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index f176b4e0ab9..32450f3d56b 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -4418,6 +4418,27 @@ QUnit.module('basic_fields', { form.destroy(); }); + QUnit.test('state_selection widget with readonly modifier', function (assert) { + assert.expect(4); + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '
', + res_id: 1, + }); + + assert.hasClass(form.$('.o_selection'), 'o_readonly_modifier'); + assert.hasClass(form.$('.o_selection > a'), 'disabled'); + assert.isNotVisible(form.$('.dropdown-menu.state')); + + testUtils.dom.click(form.$('.o_selection > a')); + assert.isNotVisible(form.$('.dropdown-menu.state')); + + form.destroy(); + }); + QUnit.test('state_selection widget in editable list view', function (assert) { assert.expect(32); -- cgit v1.2.3