Skip to Content
Menu
This question has been flagged

CODE:

 def _get_current_stock(self,cr,uid,ids,context=None):
res = super(stock_location, self).name_get(cr, uid, ids, context=context)
res1=[]
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 ?

Avatar
Discard

please mention function call too..

How do you call _get_current_stock() ?

Related Posts Replies Views Activity
1
Jan 16
39257
5
Dec 23
73340
0
Jul 16
2776
3
Jan 16
8171
1
Feb 16
3291