diff options
| author | Jorge Pinna Puissant <jpp@odoo.com> | 2020-02-24 14:43:54 +0000 |
|---|---|---|
| committer | Jorge Pinna Puissant <jpp@odoo.com> | 2020-03-13 12:52:08 +0000 |
| commit | 7718199ae08caeb97f1ae35acef8312015c6e7f9 (patch) | |
| tree | f7e985cc4dc86a0a24f23b9ee270594aabdc6b12 /odoo | |
| parent | 828531d66fee06df22054dec0a7051d47b31960c (diff) | |
[FIX] base, website: process views without xml_id
The function get_inheriting_views_arch, retrieves the architecture of
views that inherit from the given view. In the case of the module init
is currently in process only views from modules whose code is already
loaded are taken into account.
Before this commit, the function didn't process views that has been
copied (copy on write, web editor, customize show, manual copy, ...),
this raise an error when trying to install a module. For example,
install module website_sale, copy on write the view 'Main layout',
install module website_sale_wishlist.
Now, views that has been copied are also processed.
opw-2181968
closes odoo/odoo#47590
X-original-commit: d5a2890b30f869c9b4cf7aafed0e05aff9440360
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Co-authored-by: Nicolas Lempereur <nle@odoo.com>
Diffstat (limited to 'odoo')
| -rw-r--r-- | odoo/addons/base/models/ir_ui_view.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/odoo/addons/base/models/ir_ui_view.py b/odoo/addons/base/models/ir_ui_view.py index 10fdd4d0eb7..efa4dcce214 100644 --- a/odoo/addons/base/models/ir_ui_view.py +++ b/odoo/addons/base/models/ir_ui_view.py @@ -526,6 +526,14 @@ actual arch. ['active', '=', True], ] + @api.model + def _get_filter_xmlid_query(self): + """This method is meant to be overridden by other modules. + """ + return """SELECT res_id FROM ir_model_data + WHERE res_id IN %(res_ids)s AND model = 'ir.ui.view' AND module IN %(modules)s + """ + def get_inheriting_views_arch(self, model): """Retrieves the sets of views that should currently be used in the system in the right order. During the module upgrade phase it @@ -571,11 +579,8 @@ actual arch. ids_to_check = [vid for vid in view_ids if vid not in check_view_ids] if ids_to_check: loaded_modules = tuple(self.pool._init_modules) + (self._context.get('install_module'),) - query = """ - SELECT res_id FROM ir_model_data - WHERE res_id IN %s AND model = 'ir.ui.view' AND module IN %s - """ - self.env.cr.execute(query, [tuple(ids_to_check), loaded_modules]) + query = self._get_filter_xmlid_query() + self.env.cr.execute(query, {'res_ids': tuple(ids_to_check), 'modules': loaded_modules}) valid_view_ids = [r[0] for r in self.env.cr.fetchall()] + check_view_ids view_ids = [vid for vid in view_ids if vid in valid_view_ids] |
