From 905009689ba766f6cf4ba4432b5f021931bee233 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 15 Dec 2022 12:58:41 +0000 Subject: [PATCH] [FIX] base, base_install_request:
outside of
- base.view_base_module_uninstall - base.base_module_install_review_view_form - base.base_module_install_review_view_form were the only 3 views in which a node was set outside the , , , ... node. ```sql master-all=# SELECT name FROM ir_ui_view WHERE type != 'qweb' AND inherit_id IS NULL AND arch_db ->> 'en_US' not ilike '<' || type || '%'; name --------------------------------------- Uninstall module base.module.install.request.view.form base.module.install.review.view.form (3 rows) ``` These were introduced by odoo/odoo#99438. The goal was to set these warnings on top of the form view, with no margins for a better UI. While this serves an understandable purpose, not having as the root node causes issues: - First, as seen in the above revision, it requires to have to specify the view type in the XML data file, because the view type is guessed from the root node of the view ```diff Uninstall module base.module.uninstall + form ``` - Second, in the view post-processing, some implementations are based on the root node of the view, and not having `` as the root node for instance makes the view not editable, or not pass the `readonly`, `required` attributes from the Python model. https://github.com/odoo/odoo/blob/7b9bd9d37731fae724dc5d91da656dab70aa9ad4/odoo/addons/base/models/ir_ui_view.py#L1146-L1147 https://github.com/odoo/odoo/blob/7b9bd9d37731fae724dc5d91da656dab70aa9ad4/odoo/addons/base/models/ir_ui_view.py#L1375-L1379 We could use the view type from the model itself, instead of the root node, to determine the type of the view, but then you wouldn't be able to use attributes set on the view node, such as `editable="1"`, to determine if the root/view node is editable or not. https://github.com/odoo/odoo/blob/7b9bd9d37731fae724dc5d91da656dab70aa9ad4/odoo/addons/base/models/ir_ui_view.py#L1352 Because the `` node wasn't the root node in the uninstall form view, the modifiers attributes (`readonly`, `required`) were not passed from the field python model to the view, and the Studio fields `custom_views`, `custom_reports`, `custom_models`, `custom_fields` were editable in the view, while they shouldn't as those are readonly computed fields. A constraint will be added in master, to prevent developers to create views with as root node something else than the view type. The constraint is not added in stable 16.0 to avoid to suddenly raise a constraint exception for modules from the community and customers in production databases. closes #107947 closes odoo/odoo#108319 X-original-commit: c9dd160242c55dc824d4300635528dc82309f599 Signed-off-by: Yannick Tivisse (yti) --- .../base_module_install_request_views.xml | 22 +++++++++---------- .../wizard/base_module_uninstall_views.xml | 11 +++++----- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/addons/base_install_request/wizard/base_module_install_request_views.xml b/addons/base_install_request/wizard/base_module_install_request_views.xml index 97ce48eed57..ce825e98128 100644 --- a/addons/base_install_request/wizard/base_module_install_request_views.xml +++ b/addons/base_install_request/wizard/base_module_install_request_views.xml @@ -3,14 +3,13 @@ base.module.install.request.view.form base.module.install.request - form - + @@ -29,14 +28,13 @@ base.module.install.review.view.form base.module.install.review - form - + diff --git a/odoo/addons/base/wizard/base_module_uninstall_views.xml b/odoo/addons/base/wizard/base_module_uninstall_views.xml index 17c21869b3f..ed232b3fa4a 100644 --- a/odoo/addons/base/wizard/base_module_uninstall_views.xml +++ b/odoo/addons/base/wizard/base_module_uninstall_views.xml @@ -5,14 +5,13 @@ Uninstall module base.module.uninstall - form - +

Apps to Uninstall