← Back to team overview

openerp-india team mailing list archive

[Bug 1070922] [NEW] mrp_repair: crashes when selecting TYPE of an Operation

 

Public bug reported:

OpenERP 6.0 LTS

If "Stock" is removed from 'stock.location', you will get an index error
when trying to quick enter Type.

How to reproduce:
1. Delete "Stock" location
2. Go to Manufacturing -> Repair Orders -> Operations ->New. Select Type.

Traceback (most recent call last):
  File "/opt/lp/openerp/server/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/lp/openerp/server/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/lp/openerp/server/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/lp/openerp/addons/mrp_repair/mrp_repair.py", line 716, in onchange_operation_type
    stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0]
IndexError: list index out of range
[2012-10-24 18:07:16,075][CNT_Test-5] DEBUG:web-services:netrpc: rpc-dispatching exception
Traceback (most recent call last):
  File "/opt/lp/openerp/server/bin/service/netrpc_server.py", line 70, in run
    result = self.dispatch(msg[0], msg[1], msg[2:])
  File "/opt/lp/openerp/server/bin/netsvc.py", line 499, in dispatch
    raise OpenERPDispatcherException(e, tb_s)
OpenERPDispatcherException

This happens because of this code:
Line 716 of mrp_repair/mrp_repair.py: 
stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0]

I think, it will be more correct to get stock_id this way:
stock_id = self.pool.get('stock.move')._default_location_source(cr, uid)

If you want, I can produce a patch, though it is quite clear.

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1070922

Title:
  mrp_repair: crashes when selecting TYPE of an Operation

Status in OpenERP Addons (modules):
  New

Bug description:
  OpenERP 6.0 LTS

  If "Stock" is removed from 'stock.location', you will get an index
  error when trying to quick enter Type.

  How to reproduce:
  1. Delete "Stock" location
  2. Go to Manufacturing -> Repair Orders -> Operations ->New. Select Type.

  Traceback (most recent call last):
    File "/opt/lp/openerp/server/bin/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/opt/lp/openerp/server/bin/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/opt/lp/openerp/server/bin/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/opt/lp/openerp/addons/mrp_repair/mrp_repair.py", line 716, in onchange_operation_type
      stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0]
  IndexError: list index out of range
  [2012-10-24 18:07:16,075][CNT_Test-5] DEBUG:web-services:netrpc: rpc-dispatching exception
  Traceback (most recent call last):
    File "/opt/lp/openerp/server/bin/service/netrpc_server.py", line 70, in run
      result = self.dispatch(msg[0], msg[1], msg[2:])
    File "/opt/lp/openerp/server/bin/netsvc.py", line 499, in dispatch
      raise OpenERPDispatcherException(e, tb_s)
  OpenERPDispatcherException

  This happens because of this code:
  Line 716 of mrp_repair/mrp_repair.py: 
  stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0]

  I think, it will be more correct to get stock_id this way:
  stock_id = self.pool.get('stock.move')._default_location_source(cr, uid)

  If you want, I can produce a patch, though it is quite clear.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1070922/+subscriptions


Follow ups

References