[FIX] ir.ui.view (diagram): do not depend on semi-random order of _columns

The ir.ui.view.graph_get() method depended on the natural
semi-random order of Python dict keys in the _columns dict.

When the number and/or names of the _columns happened to
yield the o2m field of the "incoming transitions" *before*
the "outgoing transitions" of the "Node model"
(e.g. workflow activity), it would swap the incoming and
outgoing transitions fields around, causing a crash later
in the `tools.graph.process` method (currently an infinite
loop in the `tree_order()` method of tools.graph.py).

Closes #3614
Fixes https://bugs.launchpad.net/openobject-server/+bug/1316948
opw-633765
This commit is contained in:
Thomas Rehn 2015-04-24 13:09:05 +02:00 committed by Olivier Dony
parent 641c25b2e6
commit e8ffc09b30
1 changed files with 4 additions and 4 deletions

View File

@ -232,15 +232,15 @@ class view(osv.osv):
if model_value._obj==node_obj:
_Node_Field=model_key
_Model_Field=model_value._fields_id
flag=False
for node_key,node_value in _Node_Obj._columns.items():
if node_value._type=='one2many':
if node_value._obj==conn_obj:
if src_node in _Arrow_Obj._columns and flag:
# _Source_Field = "Incoming Arrows" (connected via des_node)
if node_value._fields_id == des_node:
_Source_Field=node_key
if des_node in _Arrow_Obj._columns and not flag:
# _Destination_Field = "Outgoing Arrows" (connected via src_node)
if node_value._fields_id == src_node:
_Destination_Field=node_key
flag = True
datas = _Model_Obj.read(cr, uid, id, [],context)
for a in _Node_Obj.read(cr,uid,datas[_Node_Field],[]):