diff options
| author | rpa (Open ERP) <rpa@tinyerp.com> | 2010-03-17 18:57:26 +0530 |
|---|---|---|
| committer | rpa (Open ERP) <rpa@tinyerp.com> | 2010-03-17 18:57:26 +0530 |
| commit | 2fc14fc77d4795ab13b0a77bbfcd8f75b893f76f (patch) | |
| tree | 324bc9200245b74ec1fc6bd1a939b5d06e80922e /addons/document | |
| parent | a6cfc17f74f392410499b071cb27dcfac92c126d (diff) | |
| parent | bd9e9ef507d254fd1c8682d6312b4e543c6bddff (diff) | |
[MERGE]: Merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2
bzr revid: rpa@tinyerp.com-20100317132726-li1bad11xetkv1wh
Diffstat (limited to 'addons/document')
| -rw-r--r-- | addons/document/directory_report.py | 2 | ||||
| -rw-r--r-- | addons/document/document_directory.py | 4 | ||||
| -rw-r--r-- | addons/document/nodes.py | 21 |
3 files changed, 13 insertions, 14 deletions
diff --git a/addons/document/directory_report.py b/addons/document/directory_report.py index aac65cc8e36..a7a3d80191b 100644 --- a/addons/document/directory_report.py +++ b/addons/document/directory_report.py @@ -45,7 +45,7 @@ class ir_action_report_xml(osv.osv): res[data.get('id')] = False return res - def _model_search(self, cr, uid, obj, name, args): + def _model_search(self, cr, uid, obj, name, args, context={}): if not len(args): return [] model_id= args[0][2] diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index 1557941e7c6..a04bfce7231 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -215,8 +215,8 @@ class document_directory(osv.osv): path.append(duri[0]) duri = duri[1:] did = nid[0] - - return (nodes.node_dir(path, nparent,ncontext,self.browse(cr,uid,did, context)), duri) + root_node = did and self.browse(cr,uid,did, context) or False + return (nodes.node_dir(path, nparent,ncontext, root_node), duri) nid = self.search(cr,uid,[('parent_id','=',did),('name','=',duri[0]),('type','=','ressource')], context=context) diff --git a/addons/document/nodes.py b/addons/document/nodes.py index 543610a0d22..c7eb80c0a45 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -49,18 +49,17 @@ class node_context(object): context """ cached_roots = {} - def __init__(self, cr, uid, context=None): - # we don't cache the cr! + def __init__(self, cr, uid, context=None): self.dbname = cr.dbname self.uid = uid self.context = context self._dirobj = pooler.get_pool(cr.dbname).get('document.directory') assert self._dirobj - self.rootdir = self._dirobj._get_root_directory(cr,uid,context) + self.rootdir = False #self._dirobj._get_root_directory(cr,uid,context) def get_uri(self, cr, uri): """ Although this fn passes back to doc.dir, it is needed since - it is a potential caching point """ + it is a potential caching point """ (ndir, duri) = self._dirobj._locate_child(cr,self.uid, self.rootdir,uri, None, self) while duri: ndir = ndir.child(cr, duri[0]) @@ -168,23 +167,23 @@ class node_dir(node_class): our_type = 'collection' def __init__(self,path, parent, context, dirr, dctx=None): super(node_dir,self).__init__(path, parent,context) - self.dir_id = dirr.id + self.dir_id = dirr and dirr.id or False #todo: more info from dirr self.mimetype = 'application/x-directory' # 'httpd/unix-directory' - self.create_date = dirr.create_date - self.domain = dirr.domain - self.res_model = dirr.ressource_type_id and dirr.ressource_type_id.model or False + self.create_date = dirr and dirr.create_date or False + self.domain = dirr and dirr.domain or [] + self.res_model = dirr and dirr.ressource_type_id and dirr.ressource_type_id.model or False # TODO: the write date should be MAX(file.write).. - self.write_date = dirr.write_date or dirr.create_date + self.write_date = dirr and (dirr.write_date or dirr.create_date) or False self.content_length = 0 if dctx: self.dctx.update(dctx) dc2 = self.context.context dc2.update(self.dctx) dc2['dir_id'] = self.dir_id - self.displayname = dirr.name - if dirr.dctx_ids: + self.displayname = dirr and dirr.name or False + if dirr and dirr.dctx_ids: for dfld in dirr.dctx_ids: try: self.dctx['dctx_' + dfld.field] = safe_eval(dfld.expr,dc2) |
