From 11cd22711c6a31d0f98628ebbbb01ab3ef5c23e8 Mon Sep 17 00:00:00 2001 From: Sylvain GARANCHER Date: Mon, 19 Oct 2015 13:55:25 +0200 Subject: [PATCH] [FIX] Fix check_xml when inheriting from views created in the same module When inheriting from a view in extension mode created in the same module, this view was not loaded during check_xml of the last view. This caused an error when the last view wants to modify elements added by its direct parent view. Example : - View1, created in module "account" - View2, mode extension, created in module "customer", inherits View1 - View3, created in module "customer", inherits View2 During update of module "customer", when loading View3, the check_xml call didn't load View2, because it's defined in the same module (and, obviously, this module has not be totally loaded at this point) This is fixed by adding direct parent of each loaded view in the check_view_ids list in context, to force them to be loaded. Closes #9135 --- openerp/addons/base/ir/ir_ui_view.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index f298087fb4c..d75046fe3f3 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -509,10 +509,15 @@ class view(osv.osv): requested (similar to ``id``) """ if context is None: context = {} + context = context.copy() # if view_id is not a root view, climb back to the top. base = v = self.browse(cr, uid, view_id, context=context) + check_view_ids = context.setdefault('check_view_ids', []) while v.mode != 'primary': + # Add inherited views to the list of loading forced views + # Otherwise, inherited views could not find elements created in their direct parents if that parent is defined in the same module + check_view_ids.append(v.id) v = v.inherit_id root_id = v.id