+ # now populate resource information
+ def update_relatives(nid, ref_id, ref_model):
+ relatives = []
+
+ for dummy, tr in transitions.items():
+ if tr['source'] == nid:
+ relatives.append(tr['target'])
+ if tr['target'] == nid:
+ relatives.append(tr['source'])
+
+ if not ref_id:
+ nodes[nid]['res'] = False
+ return
+
+ nodes[nid]['res'] = resource = {'id': ref_id, 'model': ref_model}
+
+ refobj = pool.get(ref_model).browse(cr, uid, ref_id, context=context)
+ fields = pool.get(ref_model).fields_get(cr, uid, context=context)
+
+ # check for directory_id from inherited from document module
+ if nodes[nid].get('directory_id', False):
+ resource['directory'] = self.pool.get('document.directory').get_resource_path(cr, uid, nodes[nid]['directory_id'], ref_model, ref_id)
+
+ resource['name'] = refobj.name_get(context)[0][1]
+ resource['perm'] = pool.get(ref_model).perm_read(cr, uid, [ref_id], context)[0]
+
+ for r in relatives:
+ node = nodes[r]
+ if 'res' not in node:
+ for n, f in fields.items():
+ if node['model'] == ref_model:
+ update_relatives(r, ref_id, ref_model)
+
+ elif f.get('relation') == node['model']:
+ rel = refobj[n]
+ if rel and isinstance(rel, list) :
+ rel = rel[0]
+ try: # XXX: rel has been reported as string (check it)
+ _id = (rel or False) and rel.id
+ _model = node['model']
+ update_relatives(r, _id, _model)
+ except:
+ pass
+
+ if res_id:
+ for nid, node in nodes.items():
+ if not node['gray'] and (node['active'] or node['model'] == res_model):
+ update_relatives(nid, res_id, res_model)
+ break
+
+ # calculate graph layout