Merge lp:~openerp-dev/openobject-server/6.0-bug-405962-pydot-vmt into lp:openobject-server/6.0

Proposed by Vo Minh Thu
Status: Merged
Merged at revision: 3355
Proposed branch: lp:~openerp-dev/openobject-server/6.0-bug-405962-pydot-vmt
Merge into: lp:openobject-server/6.0
Diff against target: 65 lines (+22/-8)
1 file modified
bin/addons/base/ir/workflow/print_instance.py (+22/-8)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-bug-405962-pydot-vmt
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Approve
Review via email: mp+51521@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

I think graph_get() is called by client directly (e.g. for rendering diagram views) so the non-backwards API change is going to cause trouble there. The rest seems ok.

review: Needs Fixing
Revision history for this message
Vo Minh Thu (thu) wrote :

The graph_get() method called by the clients is on ir.ui.view only. So no problem here.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

After reviewing the graphs, we should still fix the labels for subflows that are already expanded in the graph, as "Recursive Subflow:" is perhaps not the most intuitive explanation for end-users.
As discussed, we could append a line like "(see other already expanded call to this subflow)" at the end of the label -- or something shorter.

Thanks!

3354. By Vo Minh Thu

[FIX] workflow/print: changed wording for recursive cluster representation.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/base/ir/workflow/print_instance.py'
--- bin/addons/base/ir/workflow/print_instance.py 2011-01-12 08:54:42 +0000
+++ bin/addons/base/ir/workflow/print_instance.py 2011-03-03 12:58:49 +0000
@@ -25,7 +25,7 @@
25import report,pooler,tools25import report,pooler,tools
26from operator import itemgetter26from operator import itemgetter
2727
28def graph_get(cr, graph, wkf_ids, nested=False, workitem={}):28def graph_get(cr, graph, wkf_ids, nested, workitem, processed_subflows):
29 import pydot29 import pydot
30 cr.execute('select * from wkf_activity where wkf_id in ('+','.join(['%s']*len(wkf_ids))+')', wkf_ids)30 cr.execute('select * from wkf_activity where wkf_id in ('+','.join(['%s']*len(wkf_ids))+')', wkf_ids)
31 nodes = cr.dictfetchall()31 nodes = cr.dictfetchall()
@@ -34,11 +34,12 @@
34 actto = {}34 actto = {}
35 for n in nodes:35 for n in nodes:
36 activities[n['id']] = n36 activities[n['id']] = n
37 if n['subflow_id'] and nested:37 if n['subflow_id'] and nested and n['subflow_id'] not in processed_subflows:
38 processed_subflows.add(n['subflow_id']) # don't create multiple times the same cluster.
38 cr.execute('select * from wkf where id=%s', (n['subflow_id'],))39 cr.execute('select * from wkf where id=%s', (n['subflow_id'],))
39 wkfinfo = cr.dictfetchone()40 wkfinfo = cr.dictfetchone()
40 graph2 = pydot.Cluster('subflow'+str(n['subflow_id']), fontsize='12', label = """\"Subflow: %s\\nOSV: %s\"""" % ( n['name'], wkfinfo['osv']) )41 graph2 = pydot.Cluster('subflow'+str(n['subflow_id']), fontsize='12', label = "\"Subflow: %s\\nOSV: %s\"" % ( n['name'], wkfinfo['osv']) )
41 (s1,s2) = graph_get(cr, graph2, [n['subflow_id']], nested,workitem)42 (s1,s2) = graph_get(cr, graph2, [n['subflow_id']], True, workitem, processed_subflows)
42 graph.add_subgraph(graph2)43 graph.add_subgraph(graph2)
43 actfrom[n['id']] = s244 actfrom[n['id']] = s2
44 actto[n['id']] = s145 actto[n['id']] = s1
@@ -48,11 +49,22 @@
48 args['style']='filled'49 args['style']='filled'
49 args['color']='lightgrey'50 args['color']='lightgrey'
50 args['label']=n['name']51 args['label']=n['name']
52 workitems = ''
53 if n['id'] in workitem:
54 workitems = '\\nx ' + str(workitem[n['id']])
55 args['label'] += workitems
56 args['color'] = "red"
57 args['style']='filled'
51 if n['subflow_id']:58 if n['subflow_id']:
52 args['shape'] = 'box'59 args['shape'] = 'box'
53 if n['id'] in workitem:60 if nested and n['subflow_id'] in processed_subflows:
54 args['label']+='\\nx '+str(workitem[n['id']])61 cr.execute('select * from wkf where id=%s', (n['subflow_id'],))
55 args['color'] = "red"62 wkfinfo = cr.dictfetchone()
63 args['label'] = \
64 '\"Subflow: %s\\nOSV: %s\\n(already expanded)%s\"' % \
65 (n['name'], wkfinfo['osv'], workitems)
66 args['color'] = 'green'
67 args['style'] ='filled'
56 graph.add_node(pydot.Node(n['id'], **args))68 graph.add_node(pydot.Node(n['id'], **args))
57 actfrom[n['id']] = (n['id'],{})69 actfrom[n['id']] = (n['id'],{})
58 actto[n['id']] = (n['id'],{})70 actto[n['id']] = (n['id'],{})
@@ -104,7 +116,9 @@
104 for (subflow_id,) in cr.fetchall():116 for (subflow_id,) in cr.fetchall():
105 workitems.update(workitem_get(subflow_id))117 workitems.update(workitem_get(subflow_id))
106 return workitems118 return workitems
107 graph_get(cr, graph, [x[0] for x in inst], nested, workitem_get(inst_id))119
120 processed_subflows = set()
121 graph_get(cr, graph, [x[0] for x in inst], nested, workitem_get(inst_id), processed_subflows)
108122
109#123#
110# TODO: pas clean: concurrent !!!124# TODO: pas clean: concurrent !!!