[IMP] move resolution of view_ref outside of root-ancestor-searching loop

bzr revid: xmo@openerp.com-20130423111929-fs49v0xrahqsi48u
This commit is contained in:
Xavier Morel 2013-04-23 13:19:29 +02:00
parent e996f92e6c
commit c212710f25
1 changed files with 6 additions and 7 deletions

View File

@ -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: