From ff1b4bfdface0594bff573eccac9a423ed40ee08 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Thu, 10 Oct 2024 10:28:21 +0200 Subject: [PATCH] [IMP] stock_picking_putaway_recompute: Add a test with option deactivation --- .../tests/test_recompute_putaway.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/stock_picking_putaway_recompute/tests/test_recompute_putaway.py b/stock_picking_putaway_recompute/tests/test_recompute_putaway.py index ea1aade0e64..87a8b72ec47 100644 --- a/stock_picking_putaway_recompute/tests/test_recompute_putaway.py +++ b/stock_picking_putaway_recompute/tests/test_recompute_putaway.py @@ -294,3 +294,32 @@ def test_recompute_putaway_packaging(self): self.assertEqual( self.sub_location_1, self.picking.move_line_ids.location_dest_id ) + + def test_no_recompute_putaway(self): + """ + Create a single picking from Suppliers -> Stock + The created operation point to the Sub location 1 + Deactivate the option on picking type level + Change the rule to point to Sub location 2 + Launch the action to recompute putaways + The operation still points to the Sub location 1 + """ + self._create_picking() + self.picking.action_confirm() + + self.assertTrue(self.picking.move_line_ids) + self.assertEqual( + self.sub_location_1, self.picking.move_line_ids.location_dest_id + ) + + # Simulate the package is already set + self.type_in.allow_to_recompute_putaways = False + + # Change the rule destination + self.rule.location_out_id = self.sub_location_2 + + self.picking.action_recompute_putaways() + + self.assertEqual( + self.sub_location_1, self.picking.move_line_ids.location_dest_id + )