summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorsvs-odoo <svs@odoo.com>2020-01-10 09:35:54 +0000
committersvs-odoo <svs@odoo.com>2020-01-31 12:40:09 +0000
commit78562201dbdebdbf603a106feef0e8c058360125 (patch)
tree9281a3bf99315f81945818d569a1a2372545e467 /addons
parent263f0ed0b9a366150f95cab0e85c87dcff94738b (diff)
[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>
Diffstat (limited to 'addons')
-rw-r--r--addons/mrp/models/mrp_production.py4
-rw-r--r--addons/mrp/models/stock_move.py18
2 files changed, 1 insertions, 21 deletions
diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py
index 355130b7420..492e32326c4 100644
--- a/addons/mrp/models/mrp_production.py
+++ b/addons/mrp/models/mrp_production.py
@@ -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:
diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py
index 8485dd64f98..a524688b163 100644
--- a/addons/mrp/models/stock_move.py
+++ b/addons/mrp/models/stock_move.py
@@ -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,