[IMP] When consuming in mrp, take into account lot

bzr revid: jco@openerp.com-20140114173101-5999401bm7q64q1f
This commit is contained in:
Josse Colpaert
2014-01-14 18:31:01 +01:00
parent fc9d8a5458
commit 557a052cb3
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -100,7 +100,7 @@ class StockMove(osv.osv):
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):
def action_consume(self, cr, uid, ids, product_qty, location_id=False, restrict_lot_id = False, context=None):
""" Consumed product with specific quatity from specific source location.
@param product_qty: Consumed product quantity
@param location_id: Source location
@@ -110,7 +110,7 @@ class StockMove(osv.osv):
production_obj = self.pool.get('mrp.production')
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)
new_moves = super(StockMove, self).action_consume(cr, uid, [move.id], product_qty, location_id, restrict_lot_id = restrict_lot_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):
if prod.state == 'confirmed':
+1 -1
View File
@@ -75,7 +75,7 @@ class stock_move_consume(osv.osv_memory):
move_ids = context['active_ids']
for data in self.browse(cr, uid, ids, context=context):
move_obj.action_consume(cr, uid, move_ids,
data.product_qty, data.location_id.id, restrict_lot_id=data.restrict_lot_id.id,
data.product_qty, data.location_id.id, restrict_lot_id=data.restrict_lot_id and data.restrict_lot_id.id or False,
context=context)
return {'type': 'ir.actions.act_window_close'}