Speed Improvement:

faster child of

bzr revid: fp@tinyerp.com-20080814170508-r2rqh3ejju2qdtrp
This commit is contained in:
Fabien Pinckaers 2008-08-14 19:05:08 +02:00
parent c928afe1bc
commit 3285890576
2 changed files with 12 additions and 5 deletions

View File

@ -43,7 +43,6 @@ def _check_xml(self, cr, uid, ids, context={}):
logger = netsvc.Logger()
logger.notifyChannel('init', netsvc.LOG_ERROR, 'The view do not fit the required schema !')
logger.notifyChannel('init', netsvc.LOG_ERROR, relaxng.error_log.last_error)
print view.arch
return False
return True

View File

@ -52,10 +52,18 @@ class expression(object):
""" transform the leafs of the expression """
def _rec_get(ids, table, parent):
if not ids:
return []
ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context)
return ids + _rec_get(ids2, table, parent)
if table._parent_store:
doms = []
for o in table.browse(cr, uid, ids, context=context):
if doms:
doms.insert(0,'|')
doms.append(['&',('parent_left','<',o.parent_right),('parent_left','>=',o.parent_left)])
return table.search(cr, uid, doms, context=context)
else:
if not ids:
return []
ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context)
return ids + _rec_get(ids2, table, parent)
if not self.__exp:
return self