Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3316 Weergaven

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
Annuleer

please mention function call too..

How do you call _get_current_stock() ?

Gerelateerde posts Antwoorden Weergaven Activiteit
1
jan. 16
40770
5
dec. 23
75707
0
jul. 16
3662
3
jan. 16
9154
1
feb. 16
3913