[REM] mrp: remove _decrease_reserved_quanity
As `_do_unreserve` was rewrited, the `_decrease_reserved_quanity` method isn't useful since its purpose was to avoid to unlink all stock moves and it is what `_do_unreserve` cares about. See 2e41338f42e2ef9f2ac2b3e73b274c4af242b28a closes odoo/odoo#42582 Related: odoo/enterprise#7488 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
@@ -677,9 +677,7 @@ class MrpProduction(models.Model):
|
||||
old_qty = move[0].product_uom_qty
|
||||
remaining_qty = move[0].raw_material_production_id.product_qty - move[0].raw_material_production_id.qty_produced
|
||||
if quantity > 0:
|
||||
move[0]._decrease_reserved_quanity(quantity)
|
||||
move[0].with_context(do_not_unreserve=True).write({'product_uom_qty': quantity})
|
||||
move[0]._recompute_state()
|
||||
move[0].write({'product_uom_qty': quantity})
|
||||
move[0]._action_assign()
|
||||
return move[0], old_qty, quantity
|
||||
else:
|
||||
|
||||
@@ -220,24 +220,6 @@ class StockMove(models.Model):
|
||||
production._action_cancel()
|
||||
return res
|
||||
|
||||
def _decrease_reserved_quanity(self, quantity):
|
||||
""" Decrease the reservation on move lines but keeps the
|
||||
all other data.
|
||||
"""
|
||||
move_line_to_unlink = self.env['stock.move.line']
|
||||
for move in self:
|
||||
reserved_quantity = quantity
|
||||
for move_line in self.move_line_ids:
|
||||
if move_line.product_uom_qty > reserved_quantity:
|
||||
move_line.product_uom_qty = reserved_quantity
|
||||
else:
|
||||
move_line.product_uom_qty = 0
|
||||
reserved_quantity -= move_line.product_uom_qty
|
||||
if not move_line.product_uom_qty and not move_line.qty_done:
|
||||
move_line_to_unlink |= move_line
|
||||
move_line_to_unlink.unlink()
|
||||
return True
|
||||
|
||||
def _prepare_phantom_move_values(self, bom_line, product_qty, quantity_done):
|
||||
return {
|
||||
'picking_id': self.picking_id.id if self.picking_id else False,
|
||||
|
||||
Reference in New Issue
Block a user