From f0b066c14fa435b6cc4e604f3fe1dc0206b61ce1 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Tue, 14 Jul 2020 12:27:23 +0200 Subject: [PATCH] location transfer bknd: rollback move lines and fail if not assigned --- shopfloor/services/location_content_transfer.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shopfloor/services/location_content_transfer.py b/shopfloor/services/location_content_transfer.py index fd35f7905f..9601395410 100644 --- a/shopfloor/services/location_content_transfer.py +++ b/shopfloor/services/location_content_transfer.py @@ -292,6 +292,14 @@ def scan_location(self, barcode): new_moves = self._create_moves_from_location(location) new_moves._action_confirm(merge=False) new_moves._action_assign() + if not all([x.state == "assigned" for x in new_moves]): + new_moves._action_cancel() + return self._response_for_start( + message={ + "message_type": "error", + "body": _("New move lines cannot be assigned: canceled."), + } + ) pickings = new_moves.mapped("picking_id") move_lines = new_moves.move_line_ids