From eae2321cd28af2eb3b368b107732f2e1025649f0 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 3 Jul 2013 23:57:04 +0200 Subject: [PATCH] [FIX] ir.ui.view: properly validate newly created inheriting views When a new inheriting view is imported during a module installation, it is validated thanks to the _constraints on the ir.ui.view model. However the validation uses a rather convoluted system for validating the whole view tree at once (root view + all inherited changes) while only taking into account the views that belong to modules that are currently loaded. This complicated system is necessary to be able to operate on-the-fly at any point during the registry loading/initialization. Now because _constraints are checked during create() this particular validation happens *before* the external ID (ir.model.data entry) of that new view can be created (it obviously needs to wait until the view record is inserted). As a consequence the view validation cannot determine the module to which that new view belongs, and was erroneously ignoring it. Changing the view filtering to also include views from unknown modules fixes this transient problem, and also means that manually created inherited views will be validated during module init too. bzr revid: odo@openerp.com-20130703215704-x732bepiifvf4g3n --- openerp/addons/base/ir/ir_ui_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index 46e08cc6f3a..7a14bf561e4 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -179,7 +179,7 @@ class view(osv.osv): if self.pool._init: # Module init currently in progress, only consider views from modules whose code was already loaded query = """SELECT v.id FROM ir_ui_view v LEFT JOIN ir_model_data md ON (md.model = 'ir.ui.view' AND md.res_id = v.id) - WHERE v.inherit_id=%s AND v.model=%s AND md.module in %s + WHERE v.inherit_id=%s AND v.model=%s AND (md.module IS NULL or md.module in %s) ORDER BY priority""" query_params = (view_id, model, tuple(self.pool._init_modules)) else: