From 21b45c94bca3e962c668bf7fd5574cdf695e20ea Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Wed, 9 Dec 2009 18:48:51 +0530 Subject: [PATCH] [FIX] document : fix problem to get files of res obj node bzr revid: hmo@tinyerp.com-20091209131851-07u1bp2gqwxv1ady --- addons/document/nodes.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/addons/document/nodes.py b/addons/document/nodes.py index fb377fed03c..ac15b0a359c 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -62,13 +62,12 @@ class node_context(object): """ Although this fn passes back to doc.dir, it is needed since it is a potential caching point """ - (ndir, duri) = self._dirobj._locate_child(cr,self.uid, self.rootdir,uri, None, self) - + (ndir, duri) = self._dirobj._locate_child(cr,self.uid, self.rootdir,uri, None, self) while duri: ndir = ndir.child(cr, duri[0]) if not ndir: - return False - duri = duri[1:] + return False + duri = duri[1:] return ndir @@ -506,11 +505,11 @@ class node_res_obj(node_class): name = getattr(bo, namefield) if not name: continue - res.append(node_res_obj(name, self, self.context, self.res_model, res_bo = bo)) - return res + res.append(node_res_obj(name, self, self.context, self.res_model, res_bo = bo)) + if name: + where.append(('name','=',name)) where = [('parent_id','=',self.dir_id) ] - ids = dirobj.search(cr, uid, where,context=ctx) - res = [] + ids = dirobj.search(cr, uid, where,context=ctx) if ids: for dirr in dirobj.browse(cr,uid,ids,context=ctx): if dirr.type == 'directory':