Product function fields should return 0 when no locations are defined

Bug #921561 reported by Francois Pietquin (OpenERP) on 2012-01-25
104
This bug affects 17 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP Publisher's Warranty Team

Bug Description

6.1 (last update 01/25/12)

Create a mutli-company environment :
- Create a new database
- In settings, rename the company name "your company" to "company A"
- Create a second company "company B"
- Rename user "Administrator" to "Super Administrator"
- Change "Super Administrator access rights" : add "multi-company" + "extended view"
- Log out then log in
- Link "Super Administrator" to companies A and B but default filter is "company A"
- Duplicate "Super Administrator" + rename the copy "Administrator A" + link "Administrator A" to "company A" + default filter is "company A"
- Duplicate "Super Administrator" + rename the copy "Administrator B" + link "Administrator A" to "company B" + default filter is "company B"
- Install the module "Sales" : select "Company A" while setting the chart of account
- All users : associate the right "manager" for Sales/Warehouse/Accounting
- Log as "Administrator B" and define the financial settings (use default values)
- Log as "Administrator A" + open the product "Service on Timesheet" and do NOT associate to a company
- Log as "Administrator B"and open the product list :

----------------------------------------------------------------------

Client Traceback (most recent call last):
  File "/home/fpi/openerp/web/trunk/addons/web/common/http.py", line 180, in dispatch
    response["result"] = method(controller, self, **self.params)
  File "/home/fpi/openerp/web/trunk/addons/web/controllers/main.py", line 730, in search_read
    return self.do_search_read(req, model, fields, offset, limit, domain, sort)
  File "/home/fpi/openerp/web/trunk/addons/web/controllers/main.py", line 766, in do_search_read
    records = Model.read(paginated_ids, fields or False, context)
  File "/home/fpi/openerp/web/trunk/addons/web/common/openerplib/main.py", line 250, in proxy
    args, kw)
  File "/home/fpi/openerp/web/trunk/addons/web/common/openerplib/main.py", line 117, in proxy
    result = self.connector.send(self.service_name, method, *args)
  File "/home/fpi/openerp/web/trunk/addons/web/common/http.py", line 609, in send
    raise fault

Server Traceback (most recent call last):
  File "/home/fpi/openerp/web/trunk/addons/web/common/http.py", line 590, in send
    result = openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/home/fpi/openerp/server/trunk/openerp/netsvc.py", line 324, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/fpi/openerp/server/trunk/openerp/service/web_services.py", line 583, in dispatch
    res = fn(db, uid, *params)
  File "/home/fpi/openerp/server/trunk/openerp/osv/osv.py", line 166, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/fpi/openerp/server/trunk/openerp/osv/osv.py", line 120, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/fpi/openerp/server/trunk/openerp/osv/osv.py", line 175, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/fpi/openerp/server/trunk/openerp/osv/osv.py", line 163, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/fpi/openerp/server/trunk/openerp/osv/orm.py", line 3381, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/home/fpi/openerp/server/trunk/openerp/osv/orm.py", line 3492, in _read_flat
    res2 = self._columns[val[0]].get(cr, self, ids, val, user, context=context, values=res)
  File "/home/fpi/openerp/server/trunk/openerp/osv/fields.py", line 1052, in get
    result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
  File "/home/fpi/openerp/addons/trunk/stock/product.py", line 328, in _product_available
    stock = self.get_product_available(cr, uid, ids, context=c)
  File "/home/fpi/openerp/addons/trunk/stock/product.py", line 222, in get_product_available
    child_location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', location_ids)])
  File "/home/fpi/openerp/server/trunk/openerp/osv/orm.py", line 2239, in search
    return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
  File "/home/fpi/openerp/server/trunk/openerp/osv/orm.py", line 4548, in _search
    query = self._where_calc(cr, user, args, context=context)
  File "/home/fpi/openerp/server/trunk/openerp/osv/orm.py", line 4399, in _where_calc
    where_clause, where_params = e.to_sql()
  File "/home/fpi/openerp/server/trunk/openerp/osv/expression.py", line 795, in to_sql
    q2 = stack.pop()
IndexError: pop from empty list
----------------------------------------------------------------------

Thank's

Francois Pietquin
OpenERP Belgium
Professional Services

summary: - Multi-company : product (list) and location
+ [PS] Multi-company : product (list) and location

Hello ,

I have checked the Issue at my end, I face the same traceback at server side.

would you please refer this , lp : 922024

Thanks !

Changed in openobject-addons:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
affects: openobject-addons → openobject-server
ahmad badawi (ahmad-beitasoft) wrote :

the empty list is because there arent any warehouses created. you have to create a new physical location related to each company and try it again.

module product: Failsafe to quantity 0 if no locations are defined.

Changed in openobject-server:
assignee: OpenERP's Framework R&D (openerp-dev-framework) → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
affects: openobject-server → openobject-addons
Changed in openobject-addons:
importance: Medium → Wishlist
summary: - [PS] Multi-company : product (list) and location
+ Product function fields should return 0 when no locations are defined
Changed in openobject-addons:
importance: Wishlist → Low

Maybe the line 213 is wrong:
            else:
                location_ids = context['location']
if location defined in the context is neither a list nor an int

Denero Team (deneroteam) wrote :

Hi,

I am getting same error when i was trying to multiple company environment.

Can anyone suggest me the way to fix it ?

Thanks,

Dhaval Patel
Denero Team

Amit Parik (amit-parik) on 2012-12-05
Changed in openobject-addons:
importance: Low → Medium
Changed in openobject-addons:
assignee: OpenERP R&D Addons Team 2 (openerp-dev-addons2) → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance

The correction has landed in both 7.0 and trunk:
- 7.0 addons: 9032 rev-id: <email address hidden>
- trunk addons: 8568 rev-id: <email address hidden>

Thanks for reporting!

Changed in openobject-addons:
milestone: none → 7.0
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers