Skip to Content
Menu
This question has been flagged
1 Reply
9463 Views

Guys, Today I get this error and don't really know what to do with it

: Programming error: column reference "product_id" is ambiguous

LINE 2: ... SELECT 0 FROM stock_quant, stock_location WHERE product_id...

^

, in query

SELECT 0 FROM stock_quant, stock_location WHERE product_id = %s AND stock_location.id = stock_quant.location_id AND

((stock_location.parent_left >= %s AND stock_location.parent_left < %s) OR stock_location.id = %s) AND qty < 0.0 LIMIT 1

2016-01-28 10:40:36,036 5529 ERROR NewClean openerp.http: Exception during JSON request handling.

Traceback (most recent call last):

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 530, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 567, in dispatch

result = self._call_function(**self.params)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 303, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 113, in wrapper

return f(dbname, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 300, in checked_call

return self.endpoint(*a, **kw)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 796, in __call__

return self.method(*args, **kw)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 396, in response_wrap

response = f(*args, **kw)

File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 948, in call_button

action = self._call_kw(model, method, args, {})

File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 936, in _call_kw

return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/addons/iProdLoc/iprodloc.py", line 1014, in action_done

quant_obj.quants_move(cr, uid, quants, move, move.location_dest_id, lot_id=move.restrict_lot_id.id, owner_id=move.restrict_partner_id.id, context=context)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/addons/stock/stock.py", line 424, in quants_move

""", (move.product_id.id, location_to.parent_left, location_to.parent_right, location_to.id))

File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 158, in wrapper

return f(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 234, in execute

res = self._obj.execute(query, params)

ProgrammingError: column reference "product_id" is ambiguous

LINE 2: ... SELECT 0 FROM stock_quant, stock_location WHERE product_id...

^

     Any ideas ?

Avatar
Discard

"Help urgently required" is not a question. Please review the guidelines for this site at https://www.odoo.com/forum/help-1/faq - also posting your solution may help others.

Author

Next time ......

Author Best Answer

Problem solved.

In my case problem was caused by:

product_id (product.product and product.template), apparently because of that while updating table Odoo was unable to write changes into both. So query in stock.py (class stock_quant, def quants.move) must be changed:

before:

cr.execute("""                SELECT 0 FROM stock_quant, stock_location WHERE product_id = %s AND stock_location.id = stock_quant.location_id AND                ((stock_location.parent_left >= %s AND stock_location.parent_left < %s) OR stock_location.id = %s) AND qty < 0.0 LIMIT 1            """

after:

cr.execute("""                SELECT 0 FROM stock_quant, stock_location WHERE stock_quant.product_id = %s AND stock_location.id = stock_quant.location_id AND                ((stock_location.parent_left >= %s AND stock_location.parent_left < %s) OR stock_location.id = %s) AND qty < 0.0 LIMIT 1            """

Since then all problems gone.


If anyone has the same issue .... 

Greetings to:

Pawan M.


Avatar
Discard

HI Dr Box, Please I have the same problem can you tell me how you resolve this problem Thanks

Author

If you still have this problem or any other, please contact me or Pawan.