[IMP] Change order in recompute remaining quantities
bzr revid: jco@openerp.com-20140214094016-j4wg2yvq114jt7ye
This commit is contained in:
parent
13ebbdd7f6
commit
9d87cdf8ef
|
@ -3420,7 +3420,7 @@ class stock_pack_operation(osv.osv):
|
|||
def recompute_rem_qty_from_operation(self, cr, uid, op_ids, context=None):
|
||||
def _create_link_for_product(product_id, qty):
|
||||
qty_to_assign = qty
|
||||
for move in op.picking_id.move_lines:
|
||||
for move in sorted_moves:
|
||||
if move.product_id.id == product_id and move.state not in ['done', 'cancel']:
|
||||
qty_on_link = min(move.remaining_qty, qty_to_assign)
|
||||
link_obj.create(cr, uid, {'move_id': move.id, 'operation_id': op.id, 'qty': qty_on_link}, context=context)
|
||||
|
@ -3432,6 +3432,11 @@ class stock_pack_operation(osv.osv):
|
|||
link_obj = self.pool.get('stock.move.operation.link')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
package_obj = self.pool.get('stock.quant.package')
|
||||
if op_ids:
|
||||
#Calculate order of moves
|
||||
ops = self.browse(cr, uid, op_ids[0], context=context)
|
||||
sorted_moves = ops.picking_id.move_lines
|
||||
sorted_moves.sort(key = lambda x: x.product_qty - x.reserved_availability)
|
||||
for op in self.browse(cr, uid, op_ids, context=context):
|
||||
to_unlink_ids = [x.id for x in op.linked_move_operation_ids]
|
||||
if to_unlink_ids:
|
||||
|
|
Loading…
Reference in New Issue