From f22961ad07e4b04efe4b504ee5a276f20802ed1f Mon Sep 17 00:00:00 2001 From: Bruno Boi Date: Thu, 27 Apr 2023 12:54:50 +0000 Subject: [PATCH] [FIX] web,*: repair root class attr *: web + adaptations in base, fleet, hr, hr_expense, hr_recruitment, loyalty, lunch, mail, mass_mailing, note, project, stock, survey, web_tour **Foreword** Since d19037e141 the rootnode class attribute for form/list views was copied two times: - on the o_view_controller div - and on the root node of the view renderer. Examples:
...
gives
...
...
and ... gives
...
...
**Issue** This could lead to confusion and also unexpected styling issues. See this PR #119815 to read a message JS Framework team has received. See also another a fix that had to be made for x2m fields: 980244fa8 **Introduced Changes** - in the form compiler, the root node attributes are no more copied to the root div node of the compiled template the form renderer receives - the root div node generated by the form compiler now has the "o_form_renderer" class, which was removed during the recent form view refactoring. - the list renderer no more adds the root node class attribute to its "o_list_renderer" div - the X2ManyFieldDialog has been adapted too - since View, X2ManyField & X2ManyFieldDialog both need to compute view classnames derivated from the arch root node, an util has been introduced to avoid duplicating code - the whole codebase has been checked and adapted. Related: odoo/enterprise#40418 Signed-off-by: Mathieu Duckerts-Antoine --- addons/fleet/static/src/scss/fleet_form.scss | 2 +- addons/fleet/views/fleet_vehicle_views.xml | 2 +- addons/hr/static/src/scss/hr.scss | 2 +- addons/hr/views/hr_employee_public_views.xml | 2 +- addons/hr/views/hr_employee_views.xml | 2 +- .../static/src/js/tours/hr_expense.js | 8 ++--- addons/hr_expense/views/hr_expense_views.xml | 6 ++-- .../static/src/js/tours/hr_recruitment.js | 2 +- .../static/src/scss/hr_applicant.scss | 2 +- .../static/src/scss/hr_job.scss | 6 ---- .../views/hr_recruitment_source_views.xml | 2 +- addons/loyalty/static/src/scss/loyalty.scss | 2 +- .../loyalty/views/loyalty_program_views.xml | 2 +- addons/lunch/views/lunch_orders_views.xml | 2 +- addons/mail/static/src/scss/composer.scss | 2 +- .../static/src/scss/mass_mailing.scss | 6 ++-- addons/note/static/src/scss/note.scss | 2 +- addons/project/static/src/js/tours/project.js | 2 +- .../project_task_form_view.scss | 2 +- addons/project/views/project_update_views.xml | 2 +- .../src/views/list/inventory_report_list.scss | 2 +- addons/stock/views/stock_quant_views.xml | 2 +- .../src/scss/survey_question_views.scss | 2 +- addons/survey/wizard/survey_invite_views.xml | 2 +- .../src/views/fields/relational_utils.js | 3 +- .../src/views/fields/relational_utils.xml | 2 +- .../src/views/fields/x2many/x2many_field.js | 3 +- .../src/views/fields/x2many/x2many_field.xml | 2 +- .../static/src/views/form/form_compiler.js | 5 ++-- .../src/views/form/form_controller.scss | 16 +++++----- .../src/views/kanban/kanban_arch_parser.js | 1 + .../static/src/views/list/list_arch_parser.js | 3 +- .../static/src/views/list/list_renderer.xml | 1 - addons/web/static/src/views/utils.js | 17 +++++++++-- addons/web/static/src/views/view.js | 11 +++---- .../settings_form_view.scss | 6 ++-- .../settings_form_view_mobile.scss | 2 +- .../tests/views/form/form_compiler_tests.js | 14 ++++----- .../tests/views/form/form_view_tests.js | 25 ++++++++++++++++ .../static/tests/views/kanban_view_tests.js | 30 +++++++++++++++++++ .../web/static/tests/views/list_view_tests.js | 27 +++++++++++++---- .../static/src/tour_service/tour_utils.js | 2 +- odoo/addons/base/tests/test_res_config.py | 2 +- .../base/views/res_config_settings_views.xml | 2 +- 44 files changed, 159 insertions(+), 81 deletions(-) diff --git a/addons/fleet/static/src/scss/fleet_form.scss b/addons/fleet/static/src/scss/fleet_form.scss index 5afd202c80b..2fef84dd295 100644 --- a/addons/fleet/static/src/scss/fleet_form.scss +++ b/addons/fleet/static/src/scss/fleet_form.scss @@ -1,4 +1,4 @@ -.o_fleet_form { +.o_fleet_form_view .o_form_renderer { .oe_stat_button.text-warning, .oe_stat_button.text-danger { .o_stat_text { color: $o-main-text-color; diff --git a/addons/fleet/views/fleet_vehicle_views.xml b/addons/fleet/views/fleet_vehicle_views.xml index 514631e25d7..f1f3165d19e 100644 --- a/addons/fleet/views/fleet_vehicle_views.xml +++ b/addons/fleet/views/fleet_vehicle_views.xml @@ -5,7 +5,7 @@ fleet.vehicle.form fleet.vehicle -
+
diff --git a/addons/mail/static/src/scss/composer.scss b/addons/mail/static/src/scss/composer.scss index 7e2d0ef0bde..038b776197f 100644 --- a/addons/mail/static/src/scss/composer.scss +++ b/addons/mail/static/src/scss/composer.scss @@ -47,7 +47,7 @@ } } -.o_mail_composer_form { +.o_mail_composer_form .o_form_renderer { .oe-bordered-editor[name=body] .o_readonly { border: 1px solid $o-gray-300; padding: 4px; diff --git a/addons/mass_mailing/static/src/scss/mass_mailing.scss b/addons/mass_mailing/static/src/scss/mass_mailing.scss index e0d2a801c55..8e179d86382 100644 --- a/addons/mass_mailing/static/src/scss/mass_mailing.scss +++ b/addons/mass_mailing/static/src/scss/mass_mailing.scss @@ -1,4 +1,4 @@ -.o_form_view .o_mass_mailing_mailing_form { +.o_form_view.o_mass_mailing_mailing_form .o_form_renderer { input.o_field_char.o_field_widget { padding-right: 40px; // Avoid overlapping subject text on emoji widget } @@ -20,7 +20,7 @@ } } -.o_form_view .o_mass_mailing_mailing_form.o_mass_mailing_form_full_width { +.o_form_view.o_mass_mailing_mailing_form.o_mass_mailing_form_full_width .o_form_renderer { .o_form_statusbar { margin-bottom: 0; @@ -57,7 +57,7 @@ } } -.o_form_view .o_mass_mailing_mailing_form { +.o_form_view.o_mass_mailing_mailing_form .o_form_renderer { &.o_form_readonly .o_mass_mailing_subject { // Place the favorite button without breaking the emoji widget padding-right: 50px; diff --git a/addons/note/static/src/scss/note.scss b/addons/note/static/src/scss/note.scss index a8ce5fe0b68..d7b900b5568 100644 --- a/addons/note/static/src/scss/note.scss +++ b/addons/note/static/src/scss/note.scss @@ -3,7 +3,7 @@ text-decoration: line-through; } -.o_note_form_view { +.o_note_form_view .o_form_renderer { .o_form_sheet_bg { display: flex; flex-direction: column; diff --git a/addons/project/static/src/js/tours/project.js b/addons/project/static/src/js/tours/project.js index de14b561483..d66e5824629 100644 --- a/addons/project/static/src/js/tours/project.js +++ b/addons/project/static/src/js/tours/project.js @@ -117,7 +117,7 @@ registry.category("web_tour.tours").add('project_tour', { auto: true, }, { trigger: ".o_form_button_save", - extra_trigger: '.o_form_project_tasks.o_form_dirty', + extra_trigger: '.o_form_project_tasks .o_form_dirty', content: Markup(_t("You have unsaved changes - no worries! Odoo will automatically save it as you navigate.
You can discard these changes from here or manually save your task.
Let's save it manually.")), position: "bottom", }, { diff --git a/addons/project/static/src/views/project_task_form/project_task_form_view.scss b/addons/project/static/src/views/project_task_form/project_task_form_view.scss index 6658c7c8dd0..8d632592763 100644 --- a/addons/project/static/src/views/project_task_form/project_task_form_view.scss +++ b/addons/project/static/src/views/project_task_form/project_task_form_view.scss @@ -1,4 +1,4 @@ -.o_form_project_tasks { +.o_form_project_tasks .o_form_renderer { .o_widget_web_ribbon:not(.o_invisible_modifier) + div div[name="kanban_state"] > div { margin-right: 150px; padding-left: 1rem; diff --git a/addons/project/views/project_update_views.xml b/addons/project/views/project_update_views.xml index f99275ab79a..4a153f0823c 100644 --- a/addons/project/views/project_update_views.xml +++ b/addons/project/views/project_update_views.xml @@ -27,7 +27,7 @@ project.update.view.form project.update - +

diff --git a/addons/stock/static/src/views/list/inventory_report_list.scss b/addons/stock/static/src/views/list/inventory_report_list.scss index 368a76b160b..66de14cf20a 100644 --- a/addons/stock/static/src/views/list/inventory_report_list.scss +++ b/addons/stock/static/src/views/list/inventory_report_list.scss @@ -1,5 +1,5 @@ -.o_inventory_adjustments { +.o_inventory_report_list_view .o_list_renderer { button[name='action_set_inventory_quantity'] { pointer-events: auto; diff --git a/addons/stock/views/stock_quant_views.xml b/addons/stock/views/stock_quant_views.xml index db1d131fae5..778f18ea79b 100644 --- a/addons/stock/views/stock_quant_views.xml +++ b/addons/stock/views/stock_quant_views.xml @@ -363,7 +363,7 @@ stock.quant - +