[FIX] stock: action_consume was using wrong quantity field
bzr revid: qdp-launchpad@openerp.com-20130925125039-tb8e6qfxyohrk72f
This commit is contained in:
parent
f69ca3c15f
commit
9760632523
|
@ -84,27 +84,27 @@ class StockMove(osv.osv):
|
|||
'move_id': mid,
|
||||
})
|
||||
procurement_obj.signal_button_confirm(cr, uid, [proc_id])
|
||||
|
||||
|
||||
move_obj.write(cr, uid, [move.id], {
|
||||
'location_dest_id': move.location_id.id, # dummy move for the kit
|
||||
'location_dest_id': move.location_id.id, # dummy move for the kit
|
||||
'picking_id': False,
|
||||
'state': 'confirmed'
|
||||
})
|
||||
procurement_ids = procurement_obj.search(cr, uid, [('move_id','=',move.id)], context)
|
||||
procurement_ids = procurement_obj.search(cr, uid, [('move_id', '=', move.id)], context)
|
||||
procurement_obj.signal_button_confirm(cr, uid, procurement_ids)
|
||||
procurement_obj.signal_button_wait_done(cr, uid, procurement_ids)
|
||||
return processed_ids
|
||||
|
||||
|
||||
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
|
||||
""" Consumed product with specific quatity from specific source location.
|
||||
@param product_qty: Consumed product quantity
|
||||
@param location_id: Source location
|
||||
@return: Consumed lines
|
||||
"""
|
||||
"""
|
||||
res = []
|
||||
production_obj = self.pool.get('mrp.production')
|
||||
for move in self.browse(cr, uid, ids):
|
||||
move.action_confirm(context)
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
self.action_confirm(cr, uid, [move.id], context=context)
|
||||
new_moves = super(StockMove, self).action_consume(cr, uid, [move.id], product_qty, location_id, context=context)
|
||||
production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
|
||||
for prod in production_obj.browse(cr, uid, production_ids, context=context):
|
||||
|
@ -118,13 +118,13 @@ class StockMove(osv.osv):
|
|||
production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
|
||||
res.append(new_move)
|
||||
return res
|
||||
|
||||
|
||||
def action_scrap(self, cr, uid, ids, product_qty, location_id, context=None):
|
||||
""" Move the scrap/damaged product into scrap location
|
||||
@param product_qty: Scraped product quantity
|
||||
@param location_id: Scrap location
|
||||
@return: Scraped lines
|
||||
"""
|
||||
"""
|
||||
res = []
|
||||
production_obj = self.pool.get('mrp.production')
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
|
|
|
@ -1768,7 +1768,7 @@ class stock_move(osv.osv):
|
|||
uos_qty = quantity / move_qty * move.product_uos_qty
|
||||
if quantity_rest > 0:
|
||||
default_val = {
|
||||
'product_qty': quantity,
|
||||
'product_uom_qty': quantity,
|
||||
'product_uos_qty': uos_qty,
|
||||
'state': move.state,
|
||||
'location_id': location_id or move.location_id.id,
|
||||
|
@ -1776,7 +1776,7 @@ class stock_move(osv.osv):
|
|||
current_move = self.copy(cr, uid, move.id, default_val)
|
||||
res += [current_move]
|
||||
update_val = {}
|
||||
update_val['product_qty'] = quantity_rest
|
||||
update_val['product_uom_qty'] = quantity_rest
|
||||
update_val['product_uos_qty'] = uos_qty_rest
|
||||
self.write(cr, uid, [move.id], update_val)
|
||||
|
||||
|
@ -1785,7 +1785,7 @@ class stock_move(osv.osv):
|
|||
uos_qty_rest = uos_qty
|
||||
res += [move.id]
|
||||
update_val = {
|
||||
'product_qty' : quantity_rest,
|
||||
'product_uom_qty' : quantity_rest,
|
||||
'product_uos_qty' : uos_qty_rest,
|
||||
'location_id': location_id or move.location_id.id,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue