[FIX] correctly implement transition labels in diagram view

transition labels were hardcoded to the 'signal' field of the transition object, even
though labels are returned by graph_get as long as graph_get is given the correct
'label' parameter (which should be the value of arrow/@label from the view)

lp bug: https://launchpad.net/bugs/911259 fixed

bzr revid: xmo@openerp.com-20120110105429-k1u66l205niu49e1
This commit is contained in:
Xavier Morel 2012-01-10 11:54:29 +01:00
parent 54ef2cd2da
commit 420ce20c23
2 changed files with 10 additions and 6 deletions

View File

@ -10,7 +10,8 @@ class DiagramView(View):
return {'fields_view': fields_view}
@openerpweb.jsonrequest
def get_diagram_info(self, req, id, model, node, connector, src_node, des_node, **kw):
def get_diagram_info(self, req, id, model, node, connector,
src_node, des_node, label, **kw):
visible_node_fields = kw.get('visible_node_fields',[])
invisible_node_fields = kw.get('invisible_node_fields',[])
@ -36,8 +37,9 @@ class DiagramView(View):
shapes[shape_colour] = shape_color_state
ir_view = req.session.model('ir.ui.view')
graphs = ir_view.graph_get(int(id), model, node, connector, src_node, des_node, False,
(140, 180), req.session.context)
graphs = ir_view.graph_get(
int(id), model, node, connector, src_node, des_node, label,
(140, 180), req.session.context)
nodes = graphs['nodes']
transitions = graphs['transitions']
isolate_nodes = {}
@ -62,14 +64,15 @@ class DiagramView(View):
data_connectors =connector_tr.read(connector_ids, connector_fields, req.session.context)
for tr in data_connectors:
t = connectors[str(tr['id'])]
transition_id = str(tr['id'])
_sourceid, label = graphs['label'][transition_id]
t = connectors[transition_id]
t.update(
source=tr[src_node][1],
destination=tr[des_node][1],
options={},
signal=tr.get('signal')
signal=label
)
for i, fld in enumerate(connector_fields):

View File

@ -74,6 +74,7 @@ openerp.web.DiagramView = openerp.web.View.extend({
'shape': this.nodes.attrs.shape,
'src_node': this.connectors.attrs.source,
'des_node': this.connectors.attrs.destination,
'label': this.connectors.attrs.label || false,
'visible_nodes': [],
'invisible_nodes': [],
'node_fields': [],