diff options
| author | Stephane Wirtel <stephane@tinyerp.com> | 2008-09-10 09:23:35 +0200 |
|---|---|---|
| committer | Stephane Wirtel <stephane@tinyerp.com> | 2008-09-10 09:23:35 +0200 |
| commit | a05e6fe4b356a30e4febcd22983dde8e6a8b4b4d (patch) | |
| tree | ab6fe7e451341e47f3239edb8382408d18a9d9b3 /bin/addons/base | |
| parent | f20613721db626e800beeb8de8468bb295922cff (diff) | |
| parent | 2ce1603aee9fb65874a32b8c60d7c447e334f293 (diff) | |
merge
bzr revid: stephane@tinyerp.com-20080910072335-3p3vsvhjp6o59s1c
Diffstat (limited to 'bin/addons/base')
| -rw-r--r-- | bin/addons/base/ir/workflow/workflow.py | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/bin/addons/base/ir/workflow/workflow.py b/bin/addons/base/ir/workflow/workflow.py index 8b90cfee140..35b594812d7 100644 --- a/bin/addons/base/ir/workflow/workflow.py +++ b/bin/addons/base/ir/workflow/workflow.py @@ -54,34 +54,45 @@ class workflow(osv.osv): return super(workflow, self).write(cr, user, ids, vals, context=context) # - # scale = [stepx, stepy, posx, posy ] + # scale = (vertical-distance, horizontal-distance, min-node-width(optional), min-node-height(optional), margin(default=20)) # + def graph_get(self, cr, uid, id, scale, context={}): nodes= [] + nodes_name = [] transitions = [] start = [] tres = {} + no_ancester = [] workflow = self.browse(cr, uid, id, context) for a in workflow.activities: - nodes.append((a.id,a.name)) + nodes_name.append((a.id,a.name)) + nodes.append(a.id) if a.flow_start: - start.append((a.id,a.name)) + start.append(a.id) + else: + if not a.in_transitions: + no_ancester.append(a.id) + for t in a.out_transitions: - transitions.append( ((a.id,a.name), (t.act_to.id,t.act_to.name)) ) - tres[t.id] = (a.id,t.act_to.id) - g = graph(nodes, transitions) + transitions.append((a.id, t.act_to.id)) + tres[t.id] = (a.id, t.act_to.id) + + + g = graph(nodes, transitions, no_ancester) g.process(start) g.scale(*scale) result = g.result_get() results = {} - - - for r in result.items(): - r[1]['name'] = r[0][1] - results[str(r[0][0])] = r[1] - return {'node': results, 'transition': tres} + + for node in nodes_name: + results[str(node[0])] = result[node[0]] + results[str(node[0])]['name'] = node[1] + + return {'nodes': results, 'transitions': tres} + def create(self, cr, user, vals, context=None): if not context: |
