[FIX] ir_ui_view: do not change view mode when just changing the inherit
Some views have the primary mode while having an inherit_id view In such views, if the user wants to change the inherit_id, the mode must remain primary. The use case behind this is a user who want to change the inherit_id view of the view product.product.form (product.product_normal_form_view) to another view. This view is in primary mode while having an inherit_id (product.product_template_form_view). In such a case, the primary mode must remain, otherwise the view will no longer be opened by default when opening a product. Indeed, when searching the default form view of a model, it only searches for primary mode views for this model. The `all` is there because this is an `api.multi` method. We could consider adding a `self.ensure_one`, but it breaks the API if someones calls this method with multiple records. This is likely to happen, as this method is used in `write` which is likely to be called with multiple records. In my opinion, in master, this should be replaced by an onchange so the user can see the change of mode when he adds or remove an inherit_id for a view. opw-1916324 closes odoo/odoo#30241
Please register or sign in to comment