Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3338 Zobrazení

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
Zrušit

please mention function call too..

How do you call _get_current_stock() ?

Related Posts Odpovědi Zobrazení Aktivita
1
led 16
40806
5
pro 23
75747
0
čvc 16
3685
3
led 16
9188
1
úno 16
3933