From c212710f255690dfce23d28e925732cf5ad925da Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 23 Apr 2013 13:19:29 +0200 Subject: [PATCH] [IMP] move resolution of view_ref outside of root-ancestor-searching loop bzr revid: xmo@openerp.com-20130423111929-fs49v0xrahqsi48u --- openerp/osv/orm.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 50bdd7dfc2c..3a7215faae8 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -2085,17 +2085,16 @@ class BaseModel(object): parent_view_model = None view_ref = context.get(view_type + '_view_ref') + if view_ref and not view_id and '.' in view_ref: + module, view_ref = view_ref.split('.', 1) + cr.execute("SELECT res_id FROM ir_model_data WHERE model='ir.ui.view' AND module=%s AND name=%s", (module, view_ref)) + view_ref_res = cr.fetchone() + if view_ref_res: + view_id = view_ref_res[0] view_fields = ['arch', 'name', 'field_parent', 'id', 'type', 'inherit_id', 'model'] # Search for a root (i.e. without any parent) view. while True: - if view_ref and not view_id: - if '.' in view_ref: - module, view_ref = view_ref.split('.', 1) - cr.execute("SELECT res_id FROM ir_model_data WHERE model='ir.ui.view' AND module=%s AND name=%s", (module, view_ref)) - view_ref_res = cr.fetchone() - if view_ref_res: - view_id = view_ref_res[0] if view_id: ids = [view_id] else: