From e4ff2afaecdbabc010a2a560f5e2d52f8743304a Mon Sep 17 00:00:00 2001 From: luvi Date: Sun, 9 Oct 2022 12:44:57 +0000 Subject: [PATCH] [FIX] web: correct form style in x2ManyDialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since o_form_view class was not placed on the right element, as the form is displayed in a dialog, some styles were not applied in x2Many dialogs using a form view. Now, the selector matches all cases and dialogs will be stylized as expected, since the class is placed on the dialog container instead of the first div. Now, we are consistent both for dialogs and standard form views. Tests have been adapted to work as expected. closes odoo/odoo#102953 X-original-commit: af67305b43d51e1669df19d376d9bda7418ba863 Signed-off-by: Michaƫl Mattiello Signed-off-by: Luca Vitali --- .../web/static/src/views/fields/relational_utils.xml | 4 ++-- addons/web/static/src/views/form/form_controller.scss | 11 +++++++---- .../tests/views/fields/many2many_field_tests.js | 2 +- .../static/tests/views/fields/one2many_field_tests.js | 2 +- .../test_main_flows/static/tests/tours/main_flow.js | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/addons/web/static/src/views/fields/relational_utils.xml b/addons/web/static/src/views/fields/relational_utils.xml index eb3b3c74df7..81de2d49f37 100644 --- a/addons/web/static/src/views/fields/relational_utils.xml +++ b/addons/web/static/src/views/fields/relational_utils.xml @@ -2,8 +2,8 @@ - - + + diff --git a/addons/web/static/src/views/form/form_controller.scss b/addons/web/static/src/views/form/form_controller.scss index 774730e67c2..471e7f562dc 100644 --- a/addons/web/static/src/views/form/form_controller.scss +++ b/addons/web/static/src/views/form/form_controller.scss @@ -130,9 +130,6 @@ } .o_row > div > .o_field_widget, - &.o_form_editable .oe_title .o_field_char { - width: 100%; - } // Readonly specific rules .o_form_readonly { @@ -172,6 +169,10 @@ .oe_title { max-width: 75%; + + .o_field_char { + width: 100%; + } } .o_field_x2many .o_list_table .o_handle_cell .o_row_handle { @@ -620,7 +621,7 @@ box-shadow: inset 0 1px 0 $border-color; > td { border:none; - + &:empty { padding: 0; } @@ -1021,6 +1022,8 @@ // Overridden style when form view in modal .modal .modal-dialog { .o_form_view { + min-height: auto; + .o_statusbar_buttons > .btn { /** * Override to prevent the status bar from increasing height when diff --git a/addons/web/static/tests/views/fields/many2many_field_tests.js b/addons/web/static/tests/views/fields/many2many_field_tests.js index 8d22e49da8b..bf30b81c06c 100644 --- a/addons/web/static/tests/views/fields/many2many_field_tests.js +++ b/addons/web/static/tests/views/fields/many2many_field_tests.js @@ -380,7 +380,7 @@ QUnit.module("Fields", (hooks) => { await click($(target).find(".o_field_many2many .o-kanban-button-new")[0]); await click($(".modal .modal-footer .btn-primary:nth(1)")[0]); assert.ok( - $(".modal .o_form_view.o_form_editable").length, + $(".modal .o_form_view .o_form_editable").length, "should have opened a form view in edit mode, in a modal" ); await editInput(target, ".modal .o_form_view input", "A new type"); diff --git a/addons/web/static/tests/views/fields/one2many_field_tests.js b/addons/web/static/tests/views/fields/one2many_field_tests.js index cd72bb20f04..28e3a403fa8 100644 --- a/addons/web/static/tests/views/fields/one2many_field_tests.js +++ b/addons/web/static/tests/views/fields/one2many_field_tests.js @@ -9169,7 +9169,7 @@ QUnit.module("Fields", (hooks) => { assert.containsNone(target, ".modal .o_form_view .o_data_row"); // click on the action button - await click(target.querySelector(".modal .o_form_view button")); + await click(target.querySelector(".modal .o_form_editable button")); assert.containsOnce(target, ".modal .o_data_row"); assert.strictEqual(target.querySelector(".modal .o_data_cell").textContent, "gold"); diff --git a/odoo/addons/test_main_flows/static/tests/tours/main_flow.js b/odoo/addons/test_main_flows/static/tests/tours/main_flow.js index fe0321097c6..048040fe02f 100644 --- a/odoo/addons/test_main_flows/static/tests/tours/main_flow.js +++ b/odoo/addons/test_main_flows/static/tests/tours/main_flow.js @@ -828,7 +828,7 @@ tour.stepUtils.mobileModifier(tour.stepUtils.autoExpandMoreButtons('.o_control_p run: 'text 10 hours', }, { mobile: true, - trigger: '.modal-body .o_form_view div[name="name"] input', + trigger: '.modal-content.o_form_view div[name="name"] input', content: 'Enter a description this timesheet', run: 'text 10 hours', }, { @@ -838,7 +838,7 @@ tour.stepUtils.mobileModifier(tour.stepUtils.autoExpandMoreButtons('.o_control_p run: 'text 10', }, { mobile: true, - trigger: '.modal-body .o_form_view div[name="unit_amount"] input', + trigger: '.modal-content.o_form_view div[name="unit_amount"] input', content: 'Enter one hour for this timesheet', run: 'text 10', }, {