From 3c00079320c318e6297e3a9ea2690effb85244fa Mon Sep 17 00:00:00 2001 From: Lindsay Date: Fri, 4 Feb 2022 15:02:22 +0100 Subject: [PATCH] [IMP] Allow to plug custom messages for scan_location when some new_moves are not assigned --- shopfloor/services/location_content_transfer.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/shopfloor/services/location_content_transfer.py b/shopfloor/services/location_content_transfer.py index 0c52404883..c95c15d456 100644 --- a/shopfloor/services/location_content_transfer.py +++ b/shopfloor/services/location_content_transfer.py @@ -355,11 +355,10 @@ def scan_location(self, barcode): ) new_moves._action_confirm(merge=False) new_moves._action_assign() - if not all([x.state == "assigned" for x in new_moves]): + unassigned_moves_message = self._check_moves_assignation(new_moves) + if unassigned_moves_message: savepoint.rollback() - return self._response_for_start( - message=self.msg_store.new_move_lines_not_assigned() - ) + return self._response_for_start(message=unassigned_moves_message) pickings = new_moves.mapped("picking_id") move_lines = new_moves.move_line_ids for move_line in move_lines: @@ -402,6 +401,11 @@ def scan_location(self, barcode): return self._router_single_or_all_destination(pickings) + def _check_moves_assignation(self, new_moves): + if not all([x.state == "assigned" for x in new_moves]): + return self.msg_store.new_move_lines_not_assigned() + return False + def _find_transfer_move_lines_domain(self, location): return [ ("location_id", "=", location.id),