From 4a0b6f6c416b4a229e2d80e62273402558998732 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 10 Sep 2014 11:23:48 +0200 Subject: [PATCH] [IMP] Add possibity to add rereserve button and optimize action assign --- addons/stock/stock.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index f9490ea1ab5..dd2b07c8f52 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1269,6 +1269,12 @@ class stock_picking(osv.osv): move_obj.action_confirm(cr, uid, moves, context=context) return moves + def rereserve_pick(self, cr, uid, ids, context=None): + """ + This can be used to provide a button that rereserves taking into account the existing pack operations + """ + for pick in self.browse(cr, uid, ids, context=context): + self.rereserve_quants(cr, uid, pick, move_ids = [x.id for x in pick.move_lines], context=context) def rereserve_quants(self, cr, uid, picking, move_ids=[], context=None): """ Unreserve quants then try to reassign quants.""" @@ -2140,6 +2146,8 @@ class stock_move(osv.osv): quants = quant_obj.quants_get_prefered_domain(cr, uid, ops.location_id, move.product_id, qty, domain=domain, prefered_domain_list=[], restrict_lot_id=move.restrict_lot_id.id, restrict_partner_id=move.restrict_partner_id.id, context=context) quant_obj.quants_reserve(cr, uid, quants, move, record, context=context) for move in todo_moves: + if move.linked_move_operation_ids: + continue move.refresh() #then if the move isn't totally assigned, try to find quants without any specific domain if move.state != 'assigned':