From 3965acafdcea5149714ce2af3c71ba118b93ae00 Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Sat, 9 Sep 2023 14:16:12 +0200 Subject: [PATCH] [FIX] sf_single_product_transfer Remove user from backorder --- .../services/single_product_transfer.py | 4 +++- shopfloor_single_product_transfer/tests/test_set_quantity.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/shopfloor_single_product_transfer/services/single_product_transfer.py b/shopfloor_single_product_transfer/services/single_product_transfer.py index f6786dc88e..9adc7d3e6f 100644 --- a/shopfloor_single_product_transfer/services/single_product_transfer.py +++ b/shopfloor_single_product_transfer/services/single_product_transfer.py @@ -666,13 +666,15 @@ def _split_move(self, move_line): # backorder, which should not be the case. # See if there's a way to identify the moves # generated through this mechanism and avoid creating them. - move_line._split_partial_quantity() + new_move_line = move_line._split_partial_quantity() new_move = move_line.move_id.split_other_move_lines( move_line, intersection=True ) if new_move: # A new move is created in case of partial quantity new_move.extract_and_action_done() + stock = self._actions_for("stock") + stock.unmark_move_line_as_picked(new_move_line) return # In case of full quantity, post the initial move move_line.move_id.extract_and_action_done() diff --git a/shopfloor_single_product_transfer/tests/test_set_quantity.py b/shopfloor_single_product_transfer/tests/test_set_quantity.py index 8c2a0fe28a..23e21cdff2 100644 --- a/shopfloor_single_product_transfer/tests/test_set_quantity.py +++ b/shopfloor_single_product_transfer/tests/test_set_quantity.py @@ -717,10 +717,14 @@ def test_set_quantity_scan_location(self): ) self.assertEqual(backorder.move_line_ids.qty_done, 6.0) self.assertEqual(backorder.move_line_ids.state, "done") + self.assertEqual(backorder.user_id, self.env.user) + self.assertEqual(backorder.move_line_ids.shopfloor_user_id, self.env.user) self.assertEqual(picking.move_line_ids.product_uom_qty, 4.0) self.assertEqual(picking.move_line_ids.qty_done, 0.0) self.assertEqual(picking.move_line_ids.state, "assigned") self.assertFalse(picking.move_line_ids.result_package_id) + self.assertEqual(picking.user_id.id, False) + self.assertEqual(picking.move_line_ids.shopfloor_user_id.id, False) def test_set_quantity_scan_location_allow_move_create(self): self.menu.sudo().allow_move_create = True