diff options
| author | Martin Geubelle <mge@odoo.com> | 2019-03-11 11:43:53 +0000 |
|---|---|---|
| committer | Martin Geubelle <mge@odoo.com> | 2019-03-13 09:31:37 +0000 |
| commit | 170c7632f2dca698f01f466ee9d4fb154e71dd81 (patch) | |
| tree | 8542da0d85b8eaf0405e413ece34d20280000f75 /addons/web/static | |
| parent | fa4552926cae5a58ed26d8050a017b610bc5e709 (diff) | |
[FIX] web: hide handle on readonly x2m
The widget handle was displayed on x2m fields in form views, even when
the field was readonly, which makes no sense.
It is now correctly hidden.
Fixes #30580
opw-1937833
closes odoo/odoo#31743
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/src/less/form_view.less | 3 | ||||
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 37 |
2 files changed, 40 insertions, 0 deletions
diff --git a/addons/web/static/src/less/form_view.less b/addons/web/static/src/less/form_view.less index c0bb80b7a12..b32bca658f0 100644 --- a/addons/web/static/src/less/form_view.less +++ b/addons/web/static/src/less/form_view.less @@ -591,6 +591,9 @@ &.o_form_readonly .o_field_widget .o_list_view .o_row_handle { display: none; // Hide the handler in non-edit mode } + .o_field_widget.o_readonly_modifier .o_list_view .o_row_handle { + display: none; // Hide the handler on readonly fields + } // Attachments .oe_attachment { diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index 421cee8a4b1..25b8e08e46d 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -3487,6 +3487,43 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('embedded readonly one2many with handle widget', function (assert) { + assert.expect(4); + + this.data.partner.records[0].turtles = [1, 2, 3]; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch:'<form string="Partners">' + + '<sheet>' + + '<field name="turtles" readonly="1">' + + '<tree editable="top">' + + '<field name="turtle_int" widget="handle"/>' + + '<field name="turtle_foo"/>' + + '</tree>' + + '</field>' + + '</sheet>' + + '</form>', + res_id: 1, + }); + + assert.strictEqual(form.$('.o_row_handle').length, 3, + "there should be 3 handles (one for each row)"); + assert.strictEqual(form.$('.o_row_handle:visible').length, 0, + "the handles should be hidden in readonly mode"); + + form.$buttons.find('.o_form_button_edit').click(); + + assert.strictEqual(form.$('.o_row_handle').length, 3, + "the handles should still be there"); + assert.strictEqual(form.$('.o_row_handle:visible').length, 0, + "the handles should still be hidden (on readonly fields)"); + + form.destroy(); + }); + QUnit.test('onchange for embedded one2many in a one2many with a second page', function (assert) { assert.expect(1); |
