mrp_master_extension: list index out of range

Bug #894039 reported by Daniel Stenlöv
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Avanzosc developments
Fix Released
Undecided
Unassigned

Bug Description

When add Schedule Operations button is pushed and no other field has been filled the following error will pop up:

Environment Information :
System : Windows-Vista-6.1.7601-SP1
OS Name : nt
Operating System Release : Vista
Operating System Version : 6.1.7601
Operating System Architecture : 32bit
Operating System Locale : sv_SE.cp1252
Python Version : 2.5.2
OpenERP-Client Version : 6.0.2
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/opt/openerp/server/bin/netsvc.py", line 489, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/opt/openerp/server/bin/service/web_services.py", line 599, in dispatch
    res = fn(db, uid, *params)
  File "/opt/openerp/server/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/server/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/server/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp/server/bin/addons/mrp_master_extension/mrp_production.py", line 118, in default_get
    production_id = self.pool.get('mrp.production').search(cr, uid, [('name', '=', context['name'])])[0]
IndexError: list index out of range

Related branches

Revision history for this message
Daniel Stenlöv (daniel-stenlov-xclude) wrote :

If a product with a bpo is selected and the compute data button is pushed the add button will work as normal. So the error should be a missing check or something that leads to a data out of bound error.

Revision history for this message
Daniel Stenlöv (daniel-stenlov-xclude) wrote :

The code that makes the error on line 118 below:

----- CUT -----
        if 'name' in context.keys():
            production_id = self.pool.get('mrp.production').search(cr, uid, [('name', '=', context['name'])])[0]
            res.update({'production_id': production_id})
        return res
----- CUT -----

Should look like this:

----- CUT -----
        if 'name' in context.keys():
            production_id = self.pool.get('mrp.production').search(cr, uid, [('name', '=', context['name'])])
            res.update({'production_id': production_id})
        return res
----- CUT -----

Revision history for this message
Urtzi Odriozola (urtzi-odriozola) wrote :

Thanks Daniel!! Fixed in rev 133.

Changed in avanzosc:
status: New → Fix Committed
Changed in avanzosc:
status: Fix Committed → Fix Released
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.