diff options
| author | Pierre Masereel <pim@odoo.com> | 2018-12-03 11:05:52 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-12-05 07:38:30 +0000 |
| commit | b8c4b42250b9caf2ac4fef32cc85dab05ccc3b08 (patch) | |
| tree | 2995ddc0d1afc5944d346af0b05f2a76536a70f1 /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | 47480a5a8991be1a5bcfd8798d45741c25fc69f6 (diff) | |
[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
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 21 |
1 files changed, 21 insertions, 0 deletions
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: '<form><field name="selection" widget="state_selection" readonly="1"/></form>', + 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); |
