From c969825cbe5597a01429a21364d17dc000bc8154 Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Mon, 18 Sep 2023 23:07:08 +0200 Subject: [PATCH] fixup! [FIX] stock_location_orderpoint_source_relocate --- stock_location_orderpoint/tests/common.py | 9 ++++++--- .../models/stock_move.py | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/stock_location_orderpoint/tests/common.py b/stock_location_orderpoint/tests/common.py index c7907819525..55df390ec60 100644 --- a/stock_location_orderpoint/tests/common.py +++ b/stock_location_orderpoint/tests/common.py @@ -77,8 +77,9 @@ def _create_orderpoint(self, **kwargs): return location_orderpoint.save() @classmethod - def _create_move(cls, name, qty, location, location_dest): - move = cls.env["stock.move"].create( + def _create_move(cls, name, qty, location, location_dest, defaults=None): + vals = defaults or {} + vals.update( { "name": name, "date": datetime.today(), @@ -89,6 +90,7 @@ def _create_move(cls, name, qty, location, location_dest): "location_dest_id": location_dest.id, } ) + move = cls.env["stock.move"].create(vals) move._write({"create_date": datetime.now()}) move._action_confirm() return move @@ -111,12 +113,13 @@ def _create_incoming_move(cls, qty, location): move._action_done() return move - def _create_outgoing_move(self, qty, location=None): + def _create_outgoing_move(self, qty, location=None, defaults=None): move = self._create_move( "Delivery", qty, location or self.location_dest, self.env.ref("stock.stock_location_customers"), + defaults=defaults, ) move._action_assign() return move diff --git a/stock_location_orderpoint_source_relocate/models/stock_move.py b/stock_location_orderpoint_source_relocate/models/stock_move.py index 47c8aac4c90..dbc3e7e597a 100644 --- a/stock_location_orderpoint_source_relocate/models/stock_move.py +++ b/stock_location_orderpoint_source_relocate/models/stock_move.py @@ -18,4 +18,5 @@ def _apply_source_relocate(self): def _after_apply_source_relocate_rule(self): super()._after_apply_source_relocate_rule() + self = self.with_context(skip_auto_replenishment=False) self._prepare_auto_replenishment_for_waiting_moves()