[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:
svs-odoo
2020-01-31 12:40:09 +00:00
parent 263f0ed0b9
commit 78562201db
2 changed files with 1 additions and 21 deletions
+1 -3
View File
@@ -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:
-18
View File
@@ -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,