diagram view of a new model has a 50% chance to cause an error

Bug #1316948 reported by Thomas Rehn
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

I wanted to implement a diagram view for new models of a new module. When I open the diagram view, I get an error (with OpenERP 7.0 rev 5138.5.119, but the same problem appears to be in trunk as well)

Server Traceback (most recent call last):
  File "/home/thomas/openerp/server/openerp/addons/web/session.py", line 89, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/home/thomas/openerp/server/openerp/netsvc.py", line 296, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/thomas/openerp/server/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/home/thomas/openerp/server/openerp/osv/osv.py", line 190, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/thomas/openerp/server/openerp/osv/osv.py", line 132, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/thomas/openerp/server/openerp/osv/osv.py", line 199, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/thomas/openerp/server/openerp/osv/osv.py", line 187, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/thomas/openerp/server/openerp/addons/base/ir/ir_ui_view.py", line 270, in graph_get
    g.process(start)
  File "/home/thomas/openerp/server/openerp/tools/graph.py", line 696, in process
    self.order_in_rank() #Second step: ordering nodes within ranks
  File "/home/thomas/openerp/server/openerp/tools/graph.py", line 658, in order_in_rank
    self.process_order()
  File "/home/thomas/openerp/server/openerp/tools/graph.py", line 533, in process_order
    one_level_el = self.tree_list[self.start][0][1]
IndexError: list index out of range

The problem is caused by the setup in addons/base/ir/ir_ui_view.py in the method graph_get of the view class. The values of '_Source_Field' and '_Destination_Field' are determined by the order of _Node_Obj._columns.items(), which a developer cannot control. If the order happens to be wrong (as in my case, in my ir_model_fields the 'in' field was before the 'out' field), then _Source_Field and _Destination_Field must be switched.

Revision history for this message
Thomas Rehn (thomas-rehn) wrote :

The proposed bug solves the problem by using the given names for source and destination field in the iteration over all one2many fields.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :
Changed in openobject-server:
status: New → Fix Released
Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

Launchpad gets a life:)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.