From bdf16d51d708d7aabb2052a7cf56f18fc22fe9f3 Mon Sep 17 00:00:00 2001 From: "Pieter Claeys (clpi)" Date: Tue, 12 Dec 2023 13:03:27 +0100 Subject: [PATCH] [FIX] mrp: detailed operations popup results in infinite recursion To reproduce: - Create and confirm MO with a tracked component (qty 1, in stock) - Open the shop floor app and click on the move line for the component - In the pop-up, change the quantity to 2 and click save Current behavior: Crash on an infinite recursion. The issue was introduced in [1], as setting picked to True in the stock.move write triggers another call to write on the stock.move, resulting in the infinite recursion. Expected behavior when this PR is merged: The quantity on the stock.move is updated, and the popup closes. By just updating the vals of the write, we do not trigger the write method again and avoid the recursion while still maintaining the wanted functionality from [1]. [1] https://github.com/odoo/odoo/commit/fe508c6b2cb1b92d7b063cc194a3dad37f4eb255 closes odoo/odoo#145922 Signed-off-by: Tiffany Chang (tic) --- addons/mrp/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index ff474a117e5..09f5e35bea4 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -288,7 +288,7 @@ class StockMove(models.Model): if self.env.context.get('force_manual_consumption'): vals['manual_consumption'] = True if vals.get('manual_consumption'): - self.picked = True + vals['picked'] = True if 'product_uom_qty' in vals and 'move_line_ids' in vals: # first update lines then product_uom_qty as the later will unreserve # so possibly unlink lines