diff --git a/stock_available_to_promise_release/models/stock_move.py b/stock_available_to_promise_release/models/stock_move.py index 24c0596803..83276fc137 100644 --- a/stock_available_to_promise_release/models/stock_move.py +++ b/stock_available_to_promise_release/models/stock_move.py @@ -445,7 +445,7 @@ def _run_stock_rule(self): procurement_requests = [] released_moves = self.env["stock.move"] # Ensure the release_ready field is correctly computed - self.invalidate_cache(["release_ready"]) + self.invalidate_recordset(["release_ready"]) for move in self: if not move.release_ready: continue diff --git a/stock_available_to_promise_release/models/stock_picking.py b/stock_available_to_promise_release/models/stock_picking.py index 6966517f53..f766b17a4c 100644 --- a/stock_available_to_promise_release/models/stock_picking.py +++ b/stock_available_to_promise_release/models/stock_picking.py @@ -69,21 +69,17 @@ def _get_shipping_policy(self): @api.depends( "move_type", - "move_lines.ordered_available_to_promise_qty", - "move_lines.need_release", - "move_lines.state", + "move_ids.ordered_available_to_promise_qty", + "move_ids.need_release", + "move_ids.state", ) def _compute_release_ready(self): for picking in self: - move_lines = picking.move_lines.filtered( - lambda move: move._is_release_needed() - ) + moves = picking.move_ids.filtered(lambda move: move._is_release_needed()) release_ready = False - release_ready_count = sum( - 1 for move in move_lines if move._is_release_ready() - ) + release_ready_count = sum(1 for move in moves if move._is_release_ready()) if picking._get_shipping_policy() == "one": - release_ready = release_ready_count == len(move_lines) + release_ready = release_ready_count == len(moves) else: release_ready = bool(release_ready_count) picking.release_ready_count = release_ready_count diff --git a/stock_available_to_promise_release/tests/test_unrelease_merged_moves.py b/stock_available_to_promise_release/tests/test_unrelease_merged_moves.py index c41158bc78..6cb47ef688 100644 --- a/stock_available_to_promise_release/tests/test_unrelease_merged_moves.py +++ b/stock_available_to_promise_release/tests/test_unrelease_merged_moves.py @@ -51,4 +51,4 @@ def test_unrelease_merged_move(self): move = self.picking1.move_ids.filtered(lambda m: m.state == "assigned") line = move.move_line_ids self.assertEqual(move.product_uom_qty, 2.0) - self.assertEqual(line.product_uom_qty, 2.0) + self.assertEqual(line.reserved_uom_qty, 2.0)