From c998fdd77b1b55531f534fcb628903d699f48b69 Mon Sep 17 00:00:00 2001 From: FrancoisGe Date: Fri, 21 Oct 2022 14:04:15 +0000 Subject: [PATCH] [FIX] base: consider `multi_edit="1"` views editable Since odoo/odoo#95729 nodes with a `groups=` are completely removed from the views when the user is not part of the group, instead of being made invisible. In that PR, views have been adapted to add back fields, with invisible="1", when they were required, for instance when they were used in a domain of another field which was still there despite the user is not part of the given group. As `tree` views having `multi_edit="1"` where not considered as editable views, the domain of fields in these views were not validated: - https://github.com/odoo/odoo/blob/1fb8fa16ab7dc298d54f089d7163fb556dbc5fcc/odoo/addons/base/models/ir_ui_view.py#L1460 - https://github.com/odoo/odoo/blob/1fb8fa16ab7dc298d54f089d7163fb556dbc5fcc/odoo/addons/base/models/ir_ui_view.py#L1321-L1322 while they are well required for the web client, in `multi_edit="1"` this is possible to edit relational/many2one field, and therefore it will do `name_search` calls using the domain of the field, and therefore the fields used in these domains must always be present in the views. Without it, a crash in the web client occurs when attempting to edit the relational/many2one field. This revision targets to consider the `multi_edit="1"` tree views as editable, to make the field domains validated as they should be. Hence, views are adapted to add back fields with `invisible="1"` when they are required in domains of other fields. Part-of: odoo/odoo#103790 --- addons/analytic/views/analytic_account_views.xml | 1 + addons/analytic/views/analytic_line_views.xml | 2 ++ addons/crm/views/crm_lead_views.xml | 2 ++ addons/hr_contract/views/hr_contract_views.xml | 1 + addons/hr_expense/views/hr_expense_views.xml | 2 ++ addons/mrp/views/mrp_production_views.xml | 2 ++ addons/mrp/views/mrp_routing_views.xml | 2 ++ addons/mrp/views/mrp_workcenter_views.xml | 1 + addons/repair/views/repair_views.xml | 1 + addons/stock/views/stock_location_views.xml | 1 + addons/stock/views/stock_picking_views.xml | 1 + addons/stock/views/stock_scrap_views.xml | 2 ++ .../views/stock_picking_batch_views.xml | 1 + addons/web/static/tests/helpers/mock_server.js | 10 ++++------ odoo/addons/base/models/ir_ui_view.py | 2 +- 15 files changed, 24 insertions(+), 7 deletions(-) diff --git a/addons/analytic/views/analytic_account_views.xml b/addons/analytic/views/analytic_account_views.xml index 33ac5a02516..450d7b84e46 100644 --- a/addons/analytic/views/analytic_account_views.xml +++ b/addons/analytic/views/analytic_account_views.xml @@ -52,6 +52,7 @@ + diff --git a/addons/analytic/views/analytic_line_views.xml b/addons/analytic/views/analytic_line_views.xml index 733fdd67b63..c1a543e4ce8 100644 --- a/addons/analytic/views/analytic_line_views.xml +++ b/addons/analytic/views/analytic_line_views.xml @@ -5,6 +5,8 @@ account.analytic.line + + diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml index 7b7b41e7df7..36528002fe1 100644 --- a/addons/crm/views/crm_lead_views.xml +++ b/addons/crm/views/crm_lead_views.xml @@ -362,6 +362,7 @@ 10 + @@ -763,6 +764,7 @@
+ diff --git a/addons/hr_contract/views/hr_contract_views.xml b/addons/hr_contract/views/hr_contract_views.xml index 557a0ef0336..a1482aab2a0 100644 --- a/addons/hr_contract/views/hr_contract_views.xml +++ b/addons/hr_contract/views/hr_contract_views.xml @@ -239,6 +239,7 @@ hr.contract + diff --git a/addons/hr_expense/views/hr_expense_views.xml b/addons/hr_expense/views/hr_expense_views.xml index 3e260c055c5..0a455bc07a5 100644 --- a/addons/hr_expense/views/hr_expense_views.xml +++ b/addons/hr_expense/views/hr_expense_views.xml @@ -45,6 +45,7 @@ hr.expense + @@ -613,6 +614,7 @@ hr.expense.sheet + diff --git a/addons/mrp/views/mrp_production_views.xml b/addons/mrp/views/mrp_production_views.xml index ac9faf26ef3..21d8ef76fcc 100644 --- a/addons/mrp/views/mrp_production_views.xml +++ b/addons/mrp/views/mrp_production_views.xml @@ -12,6 +12,8 @@