Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Programming error - HELP

Dr Obx
on 12/30/15, 5:17 AM 275 views


 def _get_current_stock(self,cr,uid,ids,context=None):
res = super(stock_location, self).name_get(cr, uid, ids, context=context)
tot_qty = 0
product_id = 0
if context.has_key('prod_id'):
product_id = context.get('prod_id', 0)
for obj in self.browse(cr, uid, ids):
cr.execute("""SELECT sum(qty) from stock_quant where location_id != %s""" % obj.id)
tot_qty = cr.fetchall()
if product_id:
cr.execute("""SELECT sum(qty) from stock_quant where location_id != %s and product_id = %s""" % (obj.id, product_id))
tot_qty = cr.fetchall()
res1.append((obj.id, obj.name + ' ('+str(tot_qty[0][0])+' in Stock)'))
print 'Currently in stock ',res1
return res1

After I run this code, getting error:

 result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
TypeError: _get_current_stock() takes at most 4 arguments (7 given)

What I'm doing wrong ?

please mention function call too..

on 12/30/15, 8:30 AM

How do you call _get_current_stock() ?

Wilbert Tan
on 7/1/16, 5:42 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 12/30/15, 5:17 AM
Seen: 275 times
Last updated: 12/30/15, 8:13 AM