[FIX] stock : Wrong quantity on invoice when invoice based on delivery and stock move has more than one line on picking

lp bug: https://launchpad.net/bugs/1015697 fixed

bzr revid: amp@tinyerp.com-20120621091001-of46b1016rqcpyvz
This commit is contained in:
hugo
2012-06-21 14:40:01 +05:30
committed by Amit (OpenERP)
parent f49e4ca5e9
commit c5f7f6ecdf
+4 -2
View File
@@ -2082,11 +2082,13 @@ class stock_move(osv.osv):
done.append(move.id)
pickings[move.picking_id.id] = 1
r = res.pop(0)
cr.execute('update stock_move set location_id=%s, product_qty=%s where id=%s', (r[1], r[0], move.id))
product_uos_qty = self.pool.get('stock.move').onchange_quantity(cr, uid, ids, move.product_id.id, r[0], move.product_id.uom_id.id, move.product_id.uos_id.id)['value']['product_uos_qty']
cr.execute('update stock_move set location_id=%s, product_qty=%s, product_uos_qty=%s where id=%s', (r[1], r[0], r[0], move.id))
while res:
r = res.pop(0)
move_id = self.copy(cr, uid, move.id, {'product_qty': r[0], 'location_id': r[1]})
product_uos_qty = self.pool.get('stock.move').onchange_quantity(cr, uid, ids, move.product_id.id, r[0], move.product_id.uom_id.id, move.product_id.uos_id.id)['value']['product_uos_qty']
move_id = self.copy(cr, uid, move.id, {'product_uos_qty': product_uos_qty, 'product_qty': r[0], 'location_id': r[1]})
done.append(move_id)
if done:
count += len(done)