44
44
wf_service.clear_cache(cr, user)
45
45
return super(workflow, self).write(cr, user, ids, vals, context=context)
47
def get_active_workitems(self, cr, uid, res, res_id, context={}):
49
cr.execute('select * from wkf where osv=%s limit 1',(res,))
50
wkfinfo = cr.dictfetchone()
54
cr.execute('SELECT id FROM wkf_instance \
55
WHERE res_id=%s AND wkf_id=%s \
56
ORDER BY state LIMIT 1',
57
(res_id, wkfinfo['id']))
58
inst_id = cr.fetchone()
60
cr.execute('select act_id,count(*) from wkf_workitem where inst_id=%s group by act_id', (inst_id,))
61
workitems = dict(cr.fetchall())
63
return {'wkf': wkfinfo, 'workitems': workitems}
48
67
# scale = (vertical-distance, horizontal-distance, min-node-width(optional), min-node-height(optional), margin(default=20))
52
def graph_get(self, cr, uid, id, scale, context={}):
60
workflow = self.browse(cr, uid, id, context)
61
for a in workflow.activities:
62
nodes_name.append((a.id,a.name))
67
if not a.in_transitions:
68
no_ancester.append(a.id)
70
for t in a.out_transitions:
71
transitions.append((a.id, t.act_to.id))
72
tres[t.id] = (a.id, t.act_to.id)
75
g = graph(nodes, transitions, no_ancester)
78
result = g.result_get()
81
for node in nodes_name:
82
results[str(node[0])] = result[node[0]]
83
results[str(node[0])]['name'] = node[1]
85
return {'nodes': results, 'transitions': tres}
71
# def graph_get(self, cr, uid, id, scale, context={}):
79
# workflow = self.browse(cr, uid, id, context)
80
# for a in workflow.activities:
81
# nodes_name.append((a.id,a.name))
86
# if not a.in_transitions:
87
# no_ancester.append(a.id)
89
# for t in a.out_transitions:
90
# transitions.append((a.id, t.act_to.id))
91
# tres[t.id] = (a.id, t.act_to.id)
94
# g = graph(nodes, transitions, no_ancester)
97
# result = g.result_get()
100
# for node in nodes_name:
101
# results[str(node[0])] = result[node[0]]
102
# results[str(node[0])]['name'] = node[1]
104
# return {'nodes': results, 'transitions': tres}
88
107
def create(self, cr, user, vals, context=None):