return nodes.get_node_context(cr, uid, context).get_uri(cr, uri)
- def get_node_class(self, cr, uid, ids, dbro=None, context=None):
+ def get_node_class(self, cr, uid, ids, dbro=None, dynamic=False, context=None):
"""Retrieve the class of nodes for this directory
This function can be overriden by inherited classes ;)
if dbro is None:
dbro = self.browse(cr, uid, ids, context=context)
- if dbro.type == 'directory':
+ if dynamic:
+ assert dbro.type == 'directory'
+ return nodes.node_res_obj
+ elif dbro.type == 'directory':
return nodes.node_dir
elif dbro.type == 'ressource':
return nodes.node_res_dir
self.context = context
self._dirobj = pooler.get_pool(cr.dbname).get('document.directory')
self.node_file_class = node_file
+ self.extra_ctx = {} # Extra keys for context, that do _not_ trigger inequality
assert self._dirobj
self._dirobj._prepare_context(cr, uid, self, context=context)
self.rootdir = False #self._dirobj._get_root_directory(cr,uid,context)
if not res_name:
continue
# TODO Revise
- klass = self.__class__
+ klass = directory.get_node_class(directory, dynamic=True, context=ctx)
res.append(klass(res_name, self.dir_id, self, self.context, self.res_model, res_bo = bo))
ids = dirobj.search(cr, uid, where2, context=ctx)
for dirr in dirobj.browse(cr, uid, ids, context=ctx):
if dirr.type == 'directory':
- klass = self.__class__
+ klass = dirr.get_node_class(dirr, dynamic=True, context=ctx)
res.append(klass(dirr.name, dirr.id, self, self.context, self.res_model, res_bo = None, res_id = self.res_id))
elif dirr.type == 'ressource':
# child resources can be controlled by properly set dctx
dirids = dirids + dirobj.search(cr,uid, where5)
for dirr in dirobj.browse(cr, uid, dirids, context=ctx):
if dirr.type == 'directory' and not dirr.parent_id:
- klass = self.__class__
+ klass = dirr.get_node_class(dirr, dynamic=True, context=ctx)
res.append(klass(dirr.name, dirr.id, self, self.context, self.res_model, res_bo = None, res_id = self.res_id))
if dirr.type == 'ressource':
klass = dirr.get_node_class(dirr, context=ctx)