From 666a153ad039eebfbbbdb2d5d3ce619889e46622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Fri, 2 Aug 2024 11:24:00 +0200 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! sale_stock_available_to_promise_release_block: add Unblock Release wizard --- .../models/sale_order.py | 3 +++ .../tests/test_sale_block_release.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/sale_stock_available_to_promise_release_block/models/sale_order.py b/sale_stock_available_to_promise_release_block/models/sale_order.py index ac1b385d50f..1c81e774bb5 100644 --- a/sale_stock_available_to_promise_release_block/models/sale_order.py +++ b/sale_stock_available_to_promise_release_block/models/sale_order.py @@ -100,4 +100,7 @@ def action_confirm(self): self.env["unblock.release"]._reschedule_moves( order.move_to_unblock_ids, date_deadline, from_order=order ) + # Unblock the release + if not order.block_release: + order.move_to_unblock_ids.action_unblock_release() return super().action_confirm() diff --git a/sale_stock_available_to_promise_release_block/tests/test_sale_block_release.py b/sale_stock_available_to_promise_release_block/tests/test_sale_block_release.py index a56b542bee6..700036b4461 100644 --- a/sale_stock_available_to_promise_release_block/tests/test_sale_block_release.py +++ b/sale_stock_available_to_promise_release_block/tests/test_sale_block_release.py @@ -86,6 +86,9 @@ def test_unblock_release_contextual(self): for m in (existing_moves | new_moves) ) ) + self.assertTrue( + all(not m.release_blocked for m in (existing_moves | new_moves)) + ) def test_unblock_release_contextual_different_shipping_policy(self): self._set_stock(self.line.product_id, self.line.product_uom_qty) @@ -134,6 +137,9 @@ def test_unblock_release_contextual_different_shipping_policy(self): for m in (existing_moves | new_moves) ) ) + self.assertTrue( + all(not m.release_blocked for m in (existing_moves | new_moves)) + ) self.assertEqual( existing_moves.group_id.move_type, new_moves.group_id.move_type )