Browsing data: - gathering product_id and qty in selected period of time (last 6 months) in location 'production'
for obj in self.browse(cr, uid, ids):
days = obj.nod
weeks = obj.now
months = obj.nom
cr.execute(""" select product_id, sum(qty) from stock_quant where write_date ::date>=to_date('%s', 'YYYY-MM-DD') and
write_date ::date<= to_date('%s', 'YYYY-MM-DD') and location_id =%s group by product_id;""" %(obj.st_date, obj.en_date, obj.location_id.id))
toty = cr.fetchall()
Browsing data and appending in_stock: - gathering qty for product in other locations except 'production'
for prod in toty:
cr.execute(""" select sum(qty) from stock_quant where product_id = %s and location_id != 7;""" %(int(prod[0])))
in_stock = cr.fetchall()
tot_qty.append([prod[0], prod[1], in_stock[0][0]])
Browsing again and appending lmsq to the existing one: - gathering qty in selected period of time (last 1 month) in location 'production'
for prod in toty:
cr.execute(""" select sum(qty) from stock_quant where product_id = %s and write_date ::date>=to_date('%s', 'YYYY-MM-DD') and
write_date ::date<= to_date('%s', 'YYYY-MM-DD') and location_id = 7;""" %(int(prod[0]), obj.mt_date, obj.en_date))
lmsq = cr.fetchall()
print 'LMSQ ',lmsq
# joining lists
print 'PROD ',tot_qty, prod
tot_qty.append([prod[0], prod[1], in_stock[0][0]], lmsq[0][0])
What I'm doing wrong ?
ERROR:
File "/usr/lib/python2.7/dist-packages/openerp/addons/iProdLoc/iprodloc.py", line 124, in moves_get
tot_qty.append([prod[0], prod[1], in_stock[0][0]], lmsq[0][0])
TypeError: append() takes exactly one argument (2 given)