products tree view search by location_id generates 'IndexError: pop from empty list' error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
I have experienced this problem with OpenERP 7 (Version 7.0-20140118-
When searching by stock location in the products tree view, selecting any of the stock locations (ex: Physical Locations / location 1) generates the following error:
Server Traceback (most recent call last):
File "/usr/lib/
return openerp.
File "/usr/lib/
result = ExportService.
File "/usr/lib/
res = fn(db, uid, *params)
File "/usr/lib/
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/usr/lib/
return f(self, dbname, *args, **kwargs)
File "/usr/lib/
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/lib/
result = self._read_flat(cr, user, select, fields, context, load)
File "/usr/lib/
res2 = self._columns[
File "/usr/lib/
result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
File "/usr/lib/
stock = self.get_
File "/usr/lib/
child_
File "/usr/lib/
return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
File "/usr/lib/
query = self._where_
File "/usr/lib/
where_clause, where_params = e.to_sql()
File "/usr/lib/
q2 = stack.pop()
IndexError: pop from empty list
After checking line 245 of openerp/
I added the following lines in the code:
After line 231 of openerp/
231 elif type(context[
232 xLoc = context['location']
233 xLocList = xLoc.split('/')
234 if len(xLocList) > 0:
235 xLocation = xLocList[-1]
236 context['location'] = xLocation.strip()
It gets the last string in the '/' concatenated location name then updates the value of context['location'] before this next line gets executed:
location_ids = location_
This search in the original code is generating a null value when the stock location is a '/' concatenated name value.
I hope this will help others who are experiencing this same problem.