diff --git a/shopfloor/docs/single_pack_transfer_diag_seq.plantuml b/shopfloor/docs/single_pack_transfer_diag_seq.plantuml index 35865182d4..3d1f92c834 100644 --- a/shopfloor/docs/single_pack_transfer_diag_seq.plantuml +++ b/shopfloor/docs/single_pack_transfer_diag_seq.plantuml @@ -23,14 +23,14 @@ header title Single Pack Transfer scenario == /start == -start -> scan_location: **/start**(barcode[pack|location], confirmation=False) -start -> start: **/start**(barcode[pack|location], confirmation=False) +start -> scan_location: **/start**(barcode[pack|location], confirmation=None) +start -> start: **/start**(barcode[pack|location], confirmation=None) == /cancel == scan_location -> start: **/cancel**(package_level_id) == /validate == -scan_location -> scan_location: **/validate**(package_level_id, location_barcode, confirmation=False) -scan_location -> start: **/validate**(package_level_id, location_barcode, confirmation=False) +scan_location -> scan_location: **/validate**(package_level_id, location_barcode, confirmation=None) +scan_location -> start: **/validate**(package_level_id, location_barcode, confirmation=None) @enduml diff --git a/shopfloor/docs/single_pack_transfer_diag_seq.png b/shopfloor/docs/single_pack_transfer_diag_seq.png index 60b3c92024..cfa643e3da 100644 Binary files a/shopfloor/docs/single_pack_transfer_diag_seq.png and b/shopfloor/docs/single_pack_transfer_diag_seq.png differ diff --git a/shopfloor/services/cluster_picking.py b/shopfloor/services/cluster_picking.py index 721f835c72..5101fd8fc0 100644 --- a/shopfloor/services/cluster_picking.py +++ b/shopfloor/services/cluster_picking.py @@ -144,10 +144,10 @@ def _response_for_unload_all(self, batch, message=None): message=message, ) - def _response_for_confirm_unload_all(self, batch, message=None): + def _response_for_confirm_unload_all(self, batch, message=None, confirmation=None): return self._response( next_state="confirm_unload_all", - data=self._data_for_unload_all(batch), + data=self._data_for_unload_all(batch, confirmation=confirmation), message=message, ) @@ -166,10 +166,14 @@ def _response_for_unload_set_destination(self, batch, package, message=None): message=message, ) - def _response_for_confirm_unload_set_destination(self, batch, package): + def _response_for_confirm_unload_set_destination( + self, batch, package, confirmation=None + ): return self._response( next_state="confirm_unload_set_destination", - data=self._data_for_unload_single(batch, package), + data=self._data_for_unload_single( + batch, package, confirmation=confirmation + ), ) def find_batch(self): @@ -814,20 +818,24 @@ def prepare_unload(self, picking_batch_id): # the lines have different destinations return self._unload_next_package(batch) - def _data_for_unload_all(self, batch): + def _data_for_unload_all(self, batch, confirmation=None): lines = self._lines_to_unload(batch) # all the lines destinations are the same here, it looks # only for the first one first_line = fields.first(lines) data = self.data.picking_batch(batch) data.update({"location_dest": self.data.location(first_line.location_dest_id)}) + if confirmation: + data.update({"confirmation": confirmation}) return data - def _data_for_unload_single(self, batch, package): + def _data_for_unload_single(self, batch, package, confirmation=None): line = fields.first( package.planned_move_line_ids.filtered(self._filter_for_unload) ) data = self.data.picking_batch(batch) + if confirmation: + data.update({"confirmation": confirmation}) data.update( { "package": self.data.package(package), @@ -1068,7 +1076,7 @@ def change_pack_lot(self, picking_batch_id, move_line_id, barcode, quantity=None message=self.msg_store.no_package_or_lot_for_barcode(barcode), ) - def set_destination_all(self, picking_batch_id, barcode, confirmation=False): + def set_destination_all(self, picking_batch_id, barcode, confirmation=None): """Set the destination for all the lines of the batch with a dest. package This method must be used only if all the move lines which have a destination @@ -1109,10 +1117,10 @@ def set_destination_all(self, picking_batch_id, barcode, confirmation=False): batch, message=self.msg_store.dest_location_not_allowed() ) - if not confirmation and self.is_dest_location_to_confirm( + if confirmation != barcode and self.is_dest_location_to_confirm( first_line.location_dest_id, scanned_location ): - return self._response_for_confirm_unload_all(batch) + return self._response_for_confirm_unload_all(batch, confirmation=barcode) self._unload_write_destination_on_lines(lines, scanned_location) completion_info = self._actions_for("completion.info") @@ -1215,7 +1223,7 @@ def unload_scan_pack(self, picking_batch_id, package_id, barcode): return self._response_for_unload_set_destination(batch, package) def unload_scan_destination( - self, picking_batch_id, package_id, barcode, confirmation=False + self, picking_batch_id, package_id, barcode, confirmation=None ): """Scan the final destination for all the move lines moved with the Bin @@ -1227,7 +1235,7 @@ def unload_scan_destination( * unload_single: line is processed and the next bin can be unloaded * confirm_unload_set_destination: the destination is valid but not the expected, ask a confirmation. This state has to call again the - endpoint with confirmation=True + endpoint with confirmation=barcode * start_line: if the batch still has lines to pick * start: if the batch is done. In this case, this method *has* to handle the closing of the batch to create backorders. @@ -1257,7 +1265,7 @@ def _lock_lines(self, lines): self._actions_for("lock").for_update(lines) def _unload_scan_destination_lines( - self, batch, package, lines, barcode, confirmation=False + self, batch, package, lines, barcode, confirmation=None ): # Lock move lines that will be updated self._lock_lines(lines) @@ -1271,10 +1279,12 @@ def _unload_scan_destination_lines( return self._response_for_unload_set_destination( batch, package, message=self.msg_store.dest_location_not_allowed() ) - if not confirmation and self.is_dest_location_to_confirm( + if confirmation != barcode and self.is_dest_location_to_confirm( first_line.location_dest_id, scanned_location ): - return self._response_for_confirm_unload_set_destination(batch, package) + return self._response_for_confirm_unload_set_destination( + batch, package, confirmation=barcode + ) self._unload_write_destination_on_lines(lines, scanned_location) @@ -1379,7 +1389,7 @@ def set_destination_all(self): return { "picking_batch_id": {"coerce": to_int, "required": True, "type": "integer"}, "barcode": {"required": True, "type": "string"}, - "confirmation": {"type": "boolean", "nullable": True, "required": False}, + "confirmation": {"type": "string", "nullable": True, "required": False}, } def unload_split(self): @@ -1399,7 +1409,7 @@ def unload_scan_destination(self): "picking_batch_id": {"coerce": to_int, "required": True, "type": "integer"}, "package_id": {"coerce": to_int, "required": True, "type": "integer"}, "barcode": {"required": True, "type": "string"}, - "confirmation": {"type": "boolean", "nullable": True, "required": False}, + "confirmation": {"type": "string", "nullable": True, "required": False}, } @@ -1594,6 +1604,7 @@ def _schema_for_single_line_details(self): def _schema_for_unload_all(self): schema = self.schemas.picking_batch() schema["location_dest"] = self.schemas._schema_dict_of(self.schemas.location()) + schema["confirmation"] = {"type": "string", "nullable": True, "required": False} return schema @property @@ -1601,6 +1612,7 @@ def _schema_for_unload_single(self): schema = self.schemas.picking_batch() schema["package"] = self.schemas._schema_dict_of(self.schemas.package()) schema["location_dest"] = self.schemas._schema_dict_of(self.schemas.location()) + schema["confirmation"] = {"type": "string", "nullable": True, "required": False} return schema @property diff --git a/shopfloor/services/location_content_transfer.py b/shopfloor/services/location_content_transfer.py index 39a12ed6dd..9b8112acf9 100644 --- a/shopfloor/services/location_content_transfer.py +++ b/shopfloor/services/location_content_transfer.py @@ -80,7 +80,7 @@ def _response_for_scan_location(self, location=None, message=None): ) def _response_for_scan_destination_all( - self, pickings, message=None, confirmation_required=False + self, pickings, message=None, confirmation_required=None ): """Transition to the 'scan_destination_all' state @@ -116,7 +116,7 @@ def _response_for_start_single(self, pickings, message=None, popup=None): ) def _response_for_scan_destination( - self, location, next_content, message=None, confirmation_required=False + self, location, next_content, message=None, confirmation_required=None ): """Transition to the 'scan_destination' state @@ -461,7 +461,7 @@ def _lock_lines(self, lines): """Lock move lines""" self._actions_for("lock").for_update(lines) - def set_destination_all(self, location_id, barcode, confirmation=False): + def set_destination_all(self, location_id, barcode, confirmation=None): """Scan destination location for all the moves of the location barcode is a stock.location for the destination @@ -489,11 +489,11 @@ def set_destination_all(self, location_id, barcode, confirmation=False): return self._response_for_scan_destination_all( pickings, message=self.msg_store.dest_location_not_allowed() ) - if not confirmation and self.is_dest_location_to_confirm( + if confirmation != barcode and self.is_dest_location_to_confirm( move_lines.location_dest_id, scanned_location ): return self._response_for_scan_destination_all( - pickings, confirmation_required=True + pickings, confirmation_required=barcode ) self._lock_lines(move_lines) @@ -663,7 +663,7 @@ def scan_line(self, location_id, move_line_id, barcode): ) def set_destination_package( - self, location_id, package_level_id, barcode, confirmation=False + self, location_id, package_level_id, barcode, confirmation=None ): """Scan destination location for package level @@ -697,11 +697,11 @@ def set_destination_package( package_level, message=self.msg_store.dest_location_not_allowed(), ) - if not confirmation and self.is_dest_location_to_confirm( + if confirmation != barcode and self.is_dest_location_to_confirm( package_level.location_dest_id, scanned_location ): return self._response_for_scan_destination( - location, package_level, confirmation_required=True + location, package_level, confirmation_required=barcode ) package_move_lines = package_level.move_line_ids self._lock_lines(package_move_lines) @@ -722,7 +722,7 @@ def set_destination_package( ) def set_destination_line( - self, location_id, move_line_id, quantity, barcode, confirmation=False + self, location_id, move_line_id, quantity, barcode, confirmation=None ): """Scan destination location for move line @@ -754,11 +754,11 @@ def set_destination_line( return self._response_for_scan_destination( location, move_line, message=self.msg_store.dest_location_not_allowed() ) - if not confirmation and self.is_dest_location_to_confirm( + if confirmation != barcode and self.is_dest_location_to_confirm( move_line.location_dest_id, scanned_location ): return self._response_for_scan_destination( - location, move_line, confirmation_required=True + location, move_line, confirmation_required=barcode ) self._lock_lines(move_line) @@ -983,7 +983,7 @@ def set_destination_all(self): return { "location_id": {"coerce": to_int, "required": True, "type": "integer"}, "barcode": {"required": True, "type": "string"}, - "confirmation": {"type": "boolean", "nullable": True, "required": False}, + "confirmation": {"type": "string", "nullable": True, "required": False}, } def go_to_single(self): @@ -1008,7 +1008,7 @@ def set_destination_package(self): "location_id": {"coerce": to_int, "required": True, "type": "integer"}, "package_level_id": {"coerce": to_int, "required": True, "type": "integer"}, "barcode": {"required": True, "type": "string"}, - "confirmation": {"type": "boolean", "nullable": True, "required": False}, + "confirmation": {"type": "string", "nullable": True, "required": False}, } def set_destination_line(self): @@ -1017,7 +1017,7 @@ def set_destination_line(self): "move_line_id": {"coerce": to_int, "required": True, "type": "integer"}, "quantity": {"coerce": to_float, "required": True, "type": "float"}, "barcode": {"required": True, "type": "string"}, - "confirmation": {"type": "boolean", "nullable": True, "required": False}, + "confirmation": {"type": "string", "nullable": True, "required": False}, } def postpone_package(self): @@ -1084,7 +1084,7 @@ def _schema_all(self): "package_levels": self.schemas._schema_list_of(package_level_schema), "move_lines": self.schemas._schema_list_of(move_line_schema), "confirmation_required": { - "type": "boolean", + "type": "string", "nullable": True, "required": False, }, @@ -1099,7 +1099,7 @@ def _schema_single(self): "package_level": self.schemas._schema_dict_of(schema_package_level), "move_line": self.schemas._schema_dict_of(schema_move_line), "confirmation_required": { - "type": "boolean", + "type": "string", "nullable": True, "required": False, }, diff --git a/shopfloor/services/single_pack_transfer.py b/shopfloor/services/single_pack_transfer.py index 19f2390a57..9658cf1f1f 100644 --- a/shopfloor/services/single_pack_transfer.py +++ b/shopfloor/services/single_pack_transfer.py @@ -41,9 +41,9 @@ def _data_after_package_scanned(self, package_level): def _response_for_start(self, message=None, popup=None): return self._response(next_state="start", message=message, popup=popup) - def _response_for_confirm_start(self, package_level, message=None): + def _response_for_confirm_start(self, package_level, message=None, barcode=""): data = self._data_after_package_scanned(package_level) - data["confirmation_required"] = True + data["confirmation_required"] = barcode return self._response( next_state="start", data=data, @@ -51,7 +51,7 @@ def _response_for_confirm_start(self, package_level, message=None): ) def _response_for_scan_location( - self, package_level, message=None, confirmation_required=False + self, package_level, message=None, confirmation_required=None ): data = self._data_after_package_scanned(package_level) data["confirmation_required"] = confirmation_required @@ -61,7 +61,7 @@ def _response_for_scan_location( message=message, ) - def _scan_source(self, barcode, confirmation=False): + def _scan_source(self, barcode, confirmation=None): """Search a package""" search = self._actions_for("search") location = search.location_from_scan(barcode) @@ -93,7 +93,7 @@ def _scan_source(self, barcode, confirmation=False): return (None, package) - def start(self, barcode, confirmation=False): + def start(self, barcode, confirmation=None): picking_types = self.picking_types message, package = self._scan_source(barcode, confirmation) if message: @@ -164,9 +164,11 @@ def start(self, barcode, confirmation=False): message=self.msg_store.no_putaway_destination_available() ) - if package_level.is_done and not confirmation: + if package_level.is_done and confirmation != barcode: return self._response_for_confirm_start( - package_level, message=self.msg_store.already_running_ask_confirmation() + package_level, + message=self.msg_store.already_running_ask_confirmation(), + barcode=barcode, ) if not package_level.is_done: package_level.is_done = True @@ -205,7 +207,7 @@ def _create_package_level(self, package): def _is_move_state_valid(self, moves): return all(move.state != "cancel" for move in moves) - def validate(self, package_level_id, location_barcode, confirmation=False): + def validate(self, package_level_id, location_barcode, confirmation=None): """Validate the transfer""" search = self._actions_for("search") @@ -235,12 +237,12 @@ def validate(self, package_level_id, location_barcode, confirmation=False): package_level, message=self.msg_store.dest_location_not_allowed() ) - if not confirmation and self.is_dest_location_to_confirm( + if confirmation != location_barcode and self.is_dest_location_to_confirm( package_level.location_dest_id, scanned_location ): return self._response_for_scan_location( package_level, - confirmation_required=True, + confirmation_required=location_barcode, message=self.msg_store.confirm_location_changed( package_level.location_dest_id, scanned_location ), @@ -309,7 +311,7 @@ class SinglePackTransferValidator(Component): def start(self): return { "barcode": {"type": "string", "nullable": False, "required": True}, - "confirmation": {"type": "boolean", "required": False}, + "confirmation": {"type": "string", "required": False}, } def cancel(self): @@ -321,7 +323,7 @@ def validate(self): return { "package_level_id": {"coerce": to_int, "required": True, "type": "integer"}, "location_barcode": {"type": "string", "nullable": False, "required": True}, - "confirmation": {"type": "boolean", "required": False}, + "confirmation": {"type": "string", "required": False}, } @@ -380,7 +382,7 @@ def _schema_for_package_level_details(self, required=False): def _schema_confirmation_required(self): return { "confirmation_required": { - "type": "boolean", + "type": "string", "nullable": True, "required": False, }, diff --git a/shopfloor/services/zone_picking.py b/shopfloor/services/zone_picking.py index d73283f13b..c9b6d6cb61 100644 --- a/shopfloor/services/zone_picking.py +++ b/shopfloor/services/zone_picking.py @@ -204,7 +204,7 @@ def _response_for_select_line( move_lines, message=None, popup=None, - confirmation_required=False, + confirmation_required=None, product=False, sublocation=False, package=False, @@ -227,7 +227,7 @@ def _response_for_set_line_destination( self, move_line, message=None, - confirmation_required=False, + confirmation_required=None, **kw, ): if confirmation_required and not message: @@ -265,7 +265,7 @@ def _response_for_unload_all( self, move_lines, message=None, - confirmation_required=False, + confirmation_required=None, ): if confirmation_required and not message: message = self.msg_store.need_confirmation() @@ -288,7 +288,7 @@ def _response_for_unload_set_destination( self, move_line, message=None, - confirmation_required=False, + confirmation_required=None, ): if confirmation_required and not message: message = self.msg_store.need_confirmation() @@ -527,7 +527,7 @@ def _list_move_lines( def _scan_source_location( self, barcode, - confirmation=False, + confirmation=None, product_id=False, sublocation=False, package=False, @@ -597,7 +597,7 @@ def _find_product_in_location(self, location, product_id, package=False): def _scan_source_package( self, barcode, - confirmation=False, + confirmation=None, product_id=False, sublocation=False, package=False, @@ -660,10 +660,10 @@ def _scan_source_package( product=product, ) if move_lines: - if not confirmation: + if confirmation != barcode: message = self.msg_store.package_different_change() response = self._response_for_select_line( - move_lines, message, confirmation_required=True + move_lines, message, confirmation_required=barcode ) else: change_package_lot = self._actions_for("change.package.lot") @@ -696,7 +696,7 @@ def _get_prefill_qty(self, move_line, qty=0): def _scan_source_product( self, barcode, - confirmation=False, + confirmation=None, product_id=False, sublocation=False, package=False, @@ -758,7 +758,7 @@ def _scan_source_product( def _scan_source_lot( self, barcode, - confirmation=False, + confirmation=None, product_id=False, sublocation=False, package=False, @@ -811,7 +811,7 @@ def _scan_source_lot( def scan_source( self, barcode, - confirmation=False, + confirmation=None, product_id=None, sublocation_id=None, package_id=None, @@ -889,14 +889,14 @@ def scan_source( ) def _set_destination_location( - self, move_line, package, quantity, confirmation, location + self, move_line, package, quantity, confirmation, location, barcode ): location_changed = False response = None # A valid location is a sub-location of the original destination, or a # any sub-location of the picking type's default destination location - # if `confirmation is True + # if `confirmation is equal to the barcode scanned. # Ask confirmation to the user if the scanned location is not in the # expected ones but is valid (in picking type's default destination) if not self.is_dest_location_valid(move_line.move_id, location): @@ -907,7 +907,7 @@ def _set_destination_location( ) return (location_changed, response) - if not confirmation and self.is_dest_location_to_confirm( + if confirmation != barcode and self.is_dest_location_to_confirm( move_line.location_dest_id, location ): response = self._response_for_set_line_destination( @@ -915,7 +915,7 @@ def _set_destination_location( message=self.msg_store.confirm_location_changed( move_line.location_dest_id, location ), - confirmation_required=True, + confirmation_required=barcode, qty_done=quantity, ) return (location_changed, response) @@ -1081,8 +1081,8 @@ def set_destination( move_line_id, barcode, quantity, - confirmation=False, handle_complete_mix_pack=False, + confirmation=None, ): """Set a destination location (and done) or a destination package (in buffer) @@ -1186,6 +1186,7 @@ def set_destination( quantity, confirmation, location, + barcode, ) if response: if extra_message: @@ -1509,7 +1510,7 @@ def _set_destination_all_response(self, buffer_lines, message=None): return self._response_for_select_line(move_lines, message=message) return self._response_for_start(message=message) - def set_destination_all(self, barcode, confirmation=False): + def set_destination_all(self, barcode, confirmation=None): """Set the destination for all the lines in the buffer Look in ``prepare_unload`` for the definition of the buffer. @@ -1551,7 +1552,7 @@ def set_destination_all(self, barcode, confirmation=False): # destination set on buffer lines # - To confirm if the scanned destination is not a child of the # current destination set on buffer lines - if not confirmation and self.is_dest_location_to_confirm( + if confirmation != barcode and self.is_dest_location_to_confirm( buffer_lines.location_dest_id, location ): return self._response_for_unload_all( @@ -1559,7 +1560,7 @@ def set_destination_all(self, barcode, confirmation=False): message=self.msg_store.confirm_location_changed( first(buffer_lines.location_dest_id), location ), - confirmation_required=True, + confirmation_required=barcode, ) # the scanned location is still valid, use it self._write_destination_on_lines(buffer_lines, location) @@ -1661,7 +1662,7 @@ def _lock_lines(self, lines): """Lock move lines""" self._actions_for("lock").for_update(lines) - def unload_set_destination(self, package_id, barcode, confirmation=False): + def unload_set_destination(self, package_id, barcode, confirmation=None): """Scan the final destination for move lines in the buffer with the destination package @@ -1703,7 +1704,7 @@ def unload_set_destination(self, package_id, barcode, confirmation=False): # destination set on buffer lines # - To confirm if the scanned destination is not a child of the # current destination set on buffer lines - if not confirmation and self.is_dest_location_to_confirm( + if not confirmation == barcode and self.is_dest_location_to_confirm( buffer_lines.location_dest_id, location ): return self._response_for_unload_set_destination( @@ -1711,7 +1712,7 @@ def unload_set_destination(self, package_id, barcode, confirmation=False): message=self.msg_store.confirm_location_changed( first(buffer_lines.location_dest_id), location ), - confirmation_required=True, + confirmation_required=barcode, ) # the scanned location is valid, use it self._write_destination_on_lines(buffer_lines, location) @@ -1767,7 +1768,7 @@ def list_move_lines(self): def scan_source(self): return { "barcode": {"required": False, "nullable": True, "type": "string"}, - "confirmation": {"type": "boolean", "nullable": True, "required": False}, + "confirmation": {"type": "string", "nullable": True, "required": False}, "product_id": {"required": False, "nullable": True, "type": "integer"}, "sublocation_id": {"required": False, "nullable": True, "type": "integer"}, "package_id": {"required": False, "nullable": True, "type": "integer"}, @@ -1782,7 +1783,7 @@ def set_destination(self): "required": True, "type": "float", }, - "confirmation": {"type": "boolean", "nullable": True, "required": False}, + "confirmation": {"type": "string", "nullable": True, "required": False}, "handle_complete_mix_pack": { "type": "boolean", "nullable": True, @@ -1813,7 +1814,7 @@ def prepare_unload(self): def set_destination_all(self): return { "barcode": {"required": False, "nullable": True, "type": "string"}, - "confirmation": {"type": "boolean", "nullable": True, "required": False}, + "confirmation": {"type": "string", "nullable": True, "required": False}, } def unload_split(self): @@ -1829,7 +1830,7 @@ def unload_set_destination(self): return { "package_id": {"coerce": to_int, "required": True, "type": "integer"}, "barcode": {"required": False, "nullable": True, "type": "string"}, - "confirmation": {"type": "boolean", "nullable": True, "required": False}, + "confirmation": {"type": "string", "nullable": True, "required": False}, } @@ -1974,7 +1975,7 @@ def _schema_for_move_line(self): required=False, ), "confirmation_required": { - "type": "boolean", + "type": "string", "nullable": True, "required": False, }, @@ -2005,7 +2006,7 @@ def _schema_for_move_lines(self): self.schemas.move_line(with_picking=True) ), "confirmation_required": { - "type": "boolean", + "type": "string", "nullable": True, "required": False, }, diff --git a/shopfloor/tests/common.py b/shopfloor/tests/common.py index 258dcebf06..af904a95ec 100644 --- a/shopfloor/tests/common.py +++ b/shopfloor/tests/common.py @@ -26,6 +26,7 @@ def setUpClassVars(cls): cls.input_location = cls.env.ref("stock.stock_location_company") cls.shelf1 = cls.env.ref("stock.stock_location_components") cls.shelf2 = cls.env.ref("stock.stock_location_14") + cls.shelf3 = cls.shelf2.sudo().copy({"barcode": "26019853"}) @classmethod def _shopfloor_user_values(cls): diff --git a/shopfloor/tests/test_cluster_picking_unload.py b/shopfloor/tests/test_cluster_picking_unload.py index 9f0410de95..e1c2cc6aec 100644 --- a/shopfloor/tests/test_cluster_picking_unload.py +++ b/shopfloor/tests/test_cluster_picking_unload.py @@ -381,15 +381,17 @@ def test_set_destination_all_need_confirmation(self): self._set_dest_package_and_done(move_lines, self.bin1) move_lines.write({"location_dest_id": self.packing_a_location.id}) + barcode = self.packing_b_location.barcode response = self.service.dispatch( "set_destination_all", params={ "picking_batch_id": self.batch.id, - "barcode": self.packing_b_location.barcode, + "barcode": barcode, }, ) location = move_lines[0].location_dest_id data = self._data_for_batch(self.batch, location) + data["confirmation"] = barcode self.assert_response( response, next_state="confirm_unload_all", @@ -402,12 +404,13 @@ def test_set_destination_all_with_confirmation(self): self._set_dest_package_and_done(move_lines, self.bin1) move_lines.write({"location_dest_id": self.packing_a_location.id}) + barcode = self.packing_b_location.barcode response = self.service.dispatch( "set_destination_all", params={ "picking_batch_id": self.batch.id, - "barcode": self.packing_b_location.barcode, - "confirmation": True, + "barcode": barcode, + "confirmation": barcode, }, ) self.assertRecordValues( @@ -424,6 +427,29 @@ def test_set_destination_all_with_confirmation(self): message={"message_type": "success", "body": "Batch Transfer complete"}, ) + def test_set_destination_all_check_confirmation(self): + """Endpoint called confirming with a different location, ask confirmation again""" + move_lines = self.move_lines + self._set_dest_package_and_done(move_lines, self.bin1) + move_lines.write({"location_dest_id": self.packing_a_location.id}) + + barcode = self.packing_b_location.barcode + response = self.service.dispatch( + "set_destination_all", + params={ + "picking_batch_id": self.batch.id, + "barcode": barcode, + "confirmation": "other_barcode", + }, + ) + data = self._data_for_batch(self.batch, self.packing_a_location) + data["confirmation"] = barcode + self.assert_response( + response, + next_state="confirm_unload_all", + data=data, + ) + class ClusterPickingUnloadSplitCase(ClusterPickingUnloadingCommonCase): """Tests covering the /unload_split endpoint @@ -608,7 +634,7 @@ def test_scan_destination_unload_package_enabled(self): "picking_batch_id": self.batch.id, "package_id": self.bin1.id, "barcode": dest_location.barcode, - "confirmation": True, + "confirmation": dest_location.barcode, }, ) self.assertRecordValues( @@ -628,7 +654,7 @@ def test_scan_destination_unload_package_enabled(self): "picking_batch_id": self.batch.id, "package_id": self.bin2.id, "barcode": dest_location.barcode, - "confirmation": True, + "confirmation": dest_location.barcode, }, ) self.assertRecordValues( @@ -823,16 +849,18 @@ def test_unload_scan_destination_error_location_move_invalid(self): def test_unload_scan_destination_need_confirmation(self): """Endpoint called with a barcode for another (valid) location""" + barcode = self.packing_b_location.barcode response = self.service.dispatch( "unload_scan_destination", params={ "picking_batch_id": self.batch.id, "package_id": self.bin1.id, - "barcode": self.packing_b_location.barcode, + "barcode": barcode, }, ) location = self.bin1_lines[0].location_dest_id data = self._data_for_batch(self.batch, location, pack=self.bin1) + data["confirmation"] = barcode self.assert_response( response, next_state="confirm_unload_set_destination", @@ -841,13 +869,14 @@ def test_unload_scan_destination_need_confirmation(self): def test_unload_scan_destination_with_confirmation(self): """Endpoint called with a barcode for another (valid) location, confirm""" + barcode = self.packing_a_location.barcode response = self.service.dispatch( "unload_scan_destination", params={ "picking_batch_id": self.batch.id, "package_id": self.bin2.id, - "barcode": self.packing_a_location.barcode, - "confirmation": True, + "barcode": barcode, + "confirmation": barcode, }, ) self.assertRecordValues( diff --git a/shopfloor/tests/test_location_content_transfer_base.py b/shopfloor/tests/test_location_content_transfer_base.py index 6559e7b07b..68675d97ef 100644 --- a/shopfloor/tests/test_location_content_transfer_base.py +++ b/shopfloor/tests/test_location_content_transfer_base.py @@ -58,7 +58,7 @@ def assert_response_start(self, response, message=None, popup=None): ) def _assert_response_scan_destination_all( - self, state, response, pickings, message=None, confirmation_required=False + self, state, response, pickings, message=None, confirmation_required=None ): # this code is repeated from the implementation, not great, but we # mostly want to ensure the selection of pickings is right, and the @@ -80,7 +80,7 @@ def _assert_response_scan_destination_all( ) def assert_response_scan_destination_all( - self, response, pickings, message=None, confirmation_required=False + self, response, pickings, message=None, confirmation_required=None ): self._assert_response_scan_destination_all( "scan_destination_all", @@ -105,7 +105,7 @@ def assert_response_start_single( ) def _assert_response_scan_destination( - self, state, response, next_content, message=None, confirmation_required=False + self, state, response, next_content, message=None, confirmation_required=None ): location = next_content.location_id data = self.service._data_content_line_for_location(location, next_content) @@ -118,7 +118,7 @@ def _assert_response_scan_destination( ) def assert_response_scan_destination( - self, response, next_content, message=None, confirmation_required=False + self, response, next_content, message=None, confirmation_required=None ): self._assert_response_scan_destination( "scan_destination", diff --git a/shopfloor/tests/test_location_content_transfer_set_destination_all.py b/shopfloor/tests/test_location_content_transfer_set_destination_all.py index 952ba9e985..adb1c8aad6 100644 --- a/shopfloor/tests/test_location_content_transfer_set_destination_all.py +++ b/shopfloor/tests/test_location_content_transfer_set_destination_all.py @@ -247,7 +247,7 @@ def test_set_destination_all_dest_location_need_confirm(self): response, self.pickings, message=self.service.msg_store.need_confirmation(), - confirmation_required=True, + confirmation_required=self.shelf2.barcode, ) def test_set_destination_all_dest_location_confirmation(self): @@ -263,7 +263,7 @@ def test_set_destination_all_dest_location_confirmation(self): # picking type's default dest location, ask confirmation (second scan) # from the user "barcode": self.shelf2.barcode, - "confirmation": True, + "confirmation": self.shelf2.barcode, }, ) self.assert_response_start( @@ -274,6 +274,28 @@ def test_set_destination_all_dest_location_confirmation(self): ) self.assert_all_done(self.shelf2) + def test_set_destination_all_dest_location_confirm_different(self): + """Scanned different location on location confirmation. + + New confirmation is requested + """ + response = self.service.dispatch( + "set_destination_all", + params={ + "location_id": self.content_loc.id, + # expected shelf2 confirmation, but scanned shelf3 + # another confirmation is required + "barcode": self.shelf3.barcode, + "confirmation": self.shelf2.barcode, + }, + ) + self.assert_response_scan_destination_all( + response, + self.pickings, + message=self.service.msg_store.need_confirmation(), + confirmation_required=self.shelf3.barcode, + ) + def test_set_destination_all_dest_location_invalid(self): """The scanned destination location is not in the menu's picking types""" response = self.service.dispatch( diff --git a/shopfloor/tests/test_location_content_transfer_set_destination_package_or_line.py b/shopfloor/tests/test_location_content_transfer_set_destination_package_or_line.py index d780bfceeb..b16c958d68 100644 --- a/shopfloor/tests/test_location_content_transfer_set_destination_package_or_line.py +++ b/shopfloor/tests/test_location_content_transfer_set_destination_package_or_line.py @@ -140,20 +140,21 @@ def test_set_destination_package_dest_location_move_nok(self): def test_set_destination_package_dest_location_to_confirm(self): """Scanned destination location valid, but need a confirmation.""" + barcode = self.env.ref("stock.stock_location_14").barcode package_level = self.picking1.package_level_ids[0] response = self.service.dispatch( "set_destination_package", params={ "location_id": self.content_loc.id, "package_level_id": package_level.id, - "barcode": self.env.ref("stock.stock_location_14").barcode, + "barcode": barcode, }, ) self.assert_response_scan_destination( response, package_level, message=self.service.msg_store.need_confirmation(), - confirmation_required=True, + confirmation_required=barcode, ) def test_set_destination_package_dest_location_ok(self): @@ -324,6 +325,7 @@ def test_set_destination_line_dest_location_move_nok(self): def test_set_destination_line_dest_location_to_confirm(self): """Scanned destination location valid, but need a confirmation.""" + barcode = self.env.ref("stock.stock_location_14").barcode move_line = self.picking2.move_line_ids[0] response = self.service.dispatch( "set_destination_line", @@ -331,14 +333,14 @@ def test_set_destination_line_dest_location_to_confirm(self): "location_id": self.content_loc.id, "move_line_id": move_line.id, "quantity": move_line.product_uom_qty, - "barcode": self.env.ref("stock.stock_location_14").barcode, + "barcode": barcode, }, ) self.assert_response_scan_destination( response, move_line, message=self.service.msg_store.need_confirmation(), - confirmation_required=True, + confirmation_required=barcode, ) def test_set_destination_line_dest_location_ok(self): diff --git a/shopfloor/tests/test_single_pack_transfer.py b/shopfloor/tests/test_single_pack_transfer.py index b01975c45e..180cb32375 100644 --- a/shopfloor/tests/test_single_pack_transfer.py +++ b/shopfloor/tests/test_single_pack_transfer.py @@ -122,7 +122,7 @@ def test_start(self): next_state="scan_location", data=dict( self._response_package_level_data(package_level), - confirmation_required=False, + confirmation_required=None, ), ) @@ -199,7 +199,7 @@ def test_start_no_operation_create(self): ), "picking": self.data.picking(package_level.picking_id), "products": self.data.products(self.product_a), - "confirmation_required": False, + "confirmation_required": None, } self.assert_response(response, next_state="scan_location", data=expected_data) @@ -408,7 +408,7 @@ def test_start_already_started(self): }, data=dict( self._response_package_level_data(package_level), - confirmation_required=True, + confirmation_required=barcode, ), ) @@ -730,7 +730,7 @@ def test_validate_location_to_confirm(self): message=message, data=dict( self._response_package_level_data(package_level), - confirmation_required=True, + confirmation_required=sub_shelf2.barcode, ), ) @@ -765,7 +765,7 @@ def test_validate_location_with_confirm(self): "package_level_id": package_level.id, "location_barcode": self.shelf2.barcode, # acknowledge the change of destination - "confirmation": True, + "confirmation": self.shelf2.barcode, }, ) @@ -1043,7 +1043,7 @@ def test_start_package_unreserve_ok(self): next_state="scan_location", data=dict( self.service._data_after_package_scanned(new_package_level), - confirmation_required=False, + confirmation_required=None, ), ) self.assertRecordValues( diff --git a/shopfloor/tests/test_zone_picking_base.py b/shopfloor/tests/test_zone_picking_base.py index 8062897a32..6c9d008b3b 100644 --- a/shopfloor/tests/test_zone_picking_base.py +++ b/shopfloor/tests/test_zone_picking_base.py @@ -306,7 +306,7 @@ def _assert_response_select_line( move_lines, message=None, popup=None, - confirmation_required=False, + confirmation_required=None, product=None, sublocation=None, location_first=None, @@ -349,7 +349,7 @@ def assert_response_select_line( move_lines, message=None, popup=None, - confirmation_required=False, + confirmation_required=None, product=None, sublocation=None, location_first=False, @@ -378,7 +378,7 @@ def _assert_response_set_line_destination( picking_type, move_line, message=None, - confirmation_required=False, + confirmation_required=None, qty_done=None, handle_complete_mix_pack=False, ): @@ -409,7 +409,7 @@ def assert_response_set_line_destination( picking_type, move_line, message=None, - confirmation_required=False, + confirmation_required=None, qty_done=None, handle_complete_mix_pack=False, ): @@ -508,7 +508,7 @@ def _assert_response_unload_set_destination( picking_type, move_line, message=None, - confirmation_required=False, + confirmation_required=None, ): self.assert_response( response, @@ -529,7 +529,7 @@ def assert_response_unload_set_destination( picking_type, move_line, message=None, - confirmation_required=False, + confirmation_required=None, ): self._assert_response_unload_set_destination( "unload_set_destination", @@ -549,7 +549,7 @@ def _assert_response_unload_all( picking_type, move_lines, message=None, - confirmation_required=False, + confirmation_required=None, ): self.assert_response( response, @@ -570,7 +570,7 @@ def assert_response_unload_all( picking_type, move_lines, message=None, - confirmation_required=False, + confirmation_required=None, ): self._assert_response_unload_all( "unload_all", diff --git a/shopfloor/tests/test_zone_picking_complete_mix_pack_flux.py b/shopfloor/tests/test_zone_picking_complete_mix_pack_flux.py index a1d7f6cbce..33effa4587 100644 --- a/shopfloor/tests/test_zone_picking_complete_mix_pack_flux.py +++ b/shopfloor/tests/test_zone_picking_complete_mix_pack_flux.py @@ -43,7 +43,7 @@ def test_scan_source_and_set_destination_on_mixed_package(self): "move_line_id": move_line.id, "barcode": self.packing_location.barcode, "quantity": quantity_done, - "confirmation": True, + "confirmation": self.packing_location.barcode, "handle_complete_mix_pack": True, }, ) diff --git a/shopfloor/tests/test_zone_picking_select_line.py b/shopfloor/tests/test_zone_picking_select_line.py index b673d59510..84d041e5e2 100644 --- a/shopfloor/tests/test_zone_picking_select_line.py +++ b/shopfloor/tests/test_zone_picking_select_line.py @@ -332,13 +332,13 @@ def test_scan_source_barcode_package_can_replace_in_line(self): picking_type=self.picking_type, move_lines=move_lines, message=self.service.msg_store.package_different_change(), - confirmation_required=True, + confirmation_required=package1b.name, ) self.assertEqual(self.picking1.package_level_ids[0].package_id, package1) # 2nd scan response = self.service.dispatch( "scan_source", - params={"barcode": package1b.name, "confirmation": True}, + params={"barcode": package1b.name, "confirmation": package1b.name}, ) self.assert_response_set_line_destination( response, diff --git a/shopfloor/tests/test_zone_picking_set_line_destination.py b/shopfloor/tests/test_zone_picking_set_line_destination.py index e6ee4a069c..50ffe6b68a 100644 --- a/shopfloor/tests/test_zone_picking_set_line_destination.py +++ b/shopfloor/tests/test_zone_picking_set_line_destination.py @@ -22,7 +22,7 @@ def test_set_destination_wrong_parameters(self): "move_line_id": 1234567890, "barcode": self.packing_location.barcode, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) self.assert_response_start( @@ -46,7 +46,7 @@ def test_set_destination_location_confirm(self): "move_line_id": move_line.id, "barcode": self.packing_location.barcode, "quantity": quantity_done, - "confirmation": False, + "confirmation": None, }, ) # Check response @@ -58,7 +58,7 @@ def test_set_destination_location_confirm(self): message=self.service.msg_store.confirm_location_changed( move_line.location_dest_id, self.packing_location ), - confirmation_required=True, + confirmation_required=self.packing_location.barcode, qty_done=quantity_done, ) # Confirm the destination with a wrong destination (should not happen) @@ -68,7 +68,7 @@ def test_set_destination_location_confirm(self): "move_line_id": move_line.id, "barcode": self.customer_location.barcode, "quantity": move_line.product_uom_qty, - "confirmation": True, + "confirmation": self.packing_location.barcode, }, ) # Check response @@ -87,7 +87,7 @@ def test_set_destination_location_confirm(self): "move_line_id": move_line.id, "barcode": self.packing_location.barcode, "quantity": move_line.product_uom_qty, - "confirmation": True, + "confirmation": self.packing_location.barcode, }, ) # Check response @@ -116,7 +116,7 @@ def test_set_destination_location_move_invalid_location(self): "move_line_id": move_line.id, "barcode": self.packing_sublocation_b.barcode, "quantity": quantity_done, - "confirmation": True, + "confirmation": self.packing_sublocation_b.barcode, }, ) # Check response @@ -156,7 +156,7 @@ def test_set_destination_location_no_other_move_line_full_qty(self): "move_line_id": move_line.id, "barcode": self.packing_location.barcode, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) self.assertEqual(move_line.state, "done") @@ -205,7 +205,7 @@ def test_set_destination_location_no_other_move_line_partial_qty(self): "move_line_id": move_line.id, "barcode": barcode, "quantity": 6, - "confirmation": False, + "confirmation": None, }, ) self.assert_response_set_line_destination( @@ -251,7 +251,7 @@ def test_set_destination_location_several_move_line_full_qty(self): "move_line_id": move_line.id, "barcode": self.packing_location.barcode, "quantity": move_line.product_uom_qty, # 6 qty - "confirmation": False, + "confirmation": None, }, ) self.assertEqual(move_line.state, "done") @@ -313,7 +313,7 @@ def test_set_destination_location_several_move_line_partial_qty(self): "move_line_id": move_line.id, "barcode": barcode, "quantity": 4, # 4/6 qty - "confirmation": False, + "confirmation": None, }, ) self.assert_response_set_line_destination( @@ -344,7 +344,7 @@ def test_set_destination_location_zero_check(self): "move_line_id": move_line.id, "barcode": self.packing_location.barcode, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) self.assertTrue(location_is_empty()) @@ -378,7 +378,7 @@ def test_set_destination_package_full_qty(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) # Check picking data @@ -432,7 +432,7 @@ def test_set_destination_package_partial_qty(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": 6, - "confirmation": False, + "confirmation": None, }, ) # Check picking data @@ -494,7 +494,7 @@ def test_set_destination_package_zero_check(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) self.assertTrue(location_is_empty()) @@ -521,7 +521,7 @@ def test_set_same_destination_package_multiple_moves(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) self.assertTrue(location_is_empty()) @@ -543,7 +543,7 @@ def test_set_same_destination_package_multiple_moves(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) self.assertEqual( @@ -566,7 +566,7 @@ def test_set_same_destination_package_multiple_moves(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) # We now have no error in the response @@ -603,7 +603,7 @@ def test_set_same_destination_package_different_picking_type(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) self.assertEqual( @@ -659,7 +659,7 @@ def test_set_destination_package_error_concurent_work(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) # Check response @@ -693,7 +693,7 @@ def test_set_destination_location_error_concurent_work(self): "package_id": self.free_package.id, "barcode": self.packing_location.barcode, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) # Check response diff --git a/shopfloor/tests/test_zone_picking_set_line_destination_package_not_allowed.py b/shopfloor/tests/test_zone_picking_set_line_destination_package_not_allowed.py index 3166f9842c..ebc9f70c10 100644 --- a/shopfloor/tests/test_zone_picking_set_line_destination_package_not_allowed.py +++ b/shopfloor/tests/test_zone_picking_set_line_destination_package_not_allowed.py @@ -30,7 +30,7 @@ def test_set_destination_alternative_package_not_allowed_scan_package_whole_qty( "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) self.assert_response_set_line_destination( @@ -55,7 +55,7 @@ def test_set_destination_alternative_package_not_allowed_scan_package_partial_qt "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": 1.0, - "confirmation": False, + "confirmation": None, }, ) move_lines = self.service._find_location_move_lines() @@ -80,7 +80,7 @@ def test_set_destination_alternative_package_not_allowed_scan_location(self): "move_line_id": move_line.id, "barcode": self.packing_location.barcode, "quantity": move_line.product_uom_qty, - "confirmation": False, + "confirmation": None, }, ) move_lines = self.service._find_location_move_lines() diff --git a/shopfloor/tests/test_zone_picking_set_line_destination_pick_pack.py b/shopfloor/tests/test_zone_picking_set_line_destination_pick_pack.py index 16c950ec6c..46e6ce4d7b 100644 --- a/shopfloor/tests/test_zone_picking_set_line_destination_pick_pack.py +++ b/shopfloor/tests/test_zone_picking_set_line_destination_pick_pack.py @@ -61,7 +61,6 @@ def test_set_destination_location_no_carrier(self): "move_line_id": move_line.id, "barcode": self.packing_location.barcode, "quantity": quantity_done, - "confirmation": True, }, ) self.assertEqual(move_line.qty_done, previous_qty_done) @@ -90,7 +89,7 @@ def test_set_destination_location_ok_carrier(self): "move_line_id": move_line.id, "barcode": self.packing_location.barcode, "quantity": move_line.product_uom_qty, - "confirmation": True, + "confirmation": self.packing_location.barcode, }, ) # Check response @@ -126,7 +125,6 @@ def test_set_destination_package_full_qty_no_carrier(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": quantity_done, - "confirmation": True, }, ) self.assert_response_set_line_destination( @@ -156,7 +154,6 @@ def test_set_destination_package_full_qty_ok_carrier_bad_package(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": quantity_done, - "confirmation": False, }, ) self.assert_response_set_line_destination( @@ -186,7 +183,6 @@ def test_set_destination_package_full_qty_ok_carrier_ok_package(self): "move_line_id": move_line.id, "barcode": self.free_package.name, "quantity": move_line.product_uom_qty, - "confirmation": True, }, ) # Check picking data diff --git a/shopfloor/tests/test_zone_picking_unload_all.py b/shopfloor/tests/test_zone_picking_unload_all.py index bf3a4f7890..c5e8b41b63 100644 --- a/shopfloor/tests/test_zone_picking_unload_all.py +++ b/shopfloor/tests/test_zone_picking_unload_all.py @@ -112,7 +112,7 @@ def test_set_destination_all_confirm_destination(self): packing_sublocation1, packing_sublocation2, ), - confirmation_required=True, + confirmation_required=packing_sublocation2.barcode, ) # set an allowed destination location (inside the picking type default # destination location) for all lines in the buffer with an expected one diff --git a/shopfloor/tests/test_zone_picking_unload_set_destination.py b/shopfloor/tests/test_zone_picking_unload_set_destination.py index ecb9120c3d..d3320cc591 100644 --- a/shopfloor/tests/test_zone_picking_unload_set_destination.py +++ b/shopfloor/tests/test_zone_picking_unload_set_destination.py @@ -164,7 +164,7 @@ def test_unload_set_destination_unload_package_enabled(self): params={ "package_id": self.free_package.id, "barcode": packing_sublocation2.barcode, - "confirmation": True, + "confirmation": packing_sublocation2.barcode, }, ) # Response has already been tested in the test above @@ -219,7 +219,7 @@ def test_unload_set_destination_confirm_location(self): message=self.service.msg_store.confirm_location_changed( packing_sublocation1, packing_sublocation2 ), - confirmation_required=True, + confirmation_required=packing_sublocation2.barcode, ) def test_unload_set_destination_ok_buffer_empty(self): @@ -248,7 +248,7 @@ def test_unload_set_destination_ok_buffer_empty(self): params={ "package_id": self.free_package.id, "barcode": packing_sublocation.barcode, - "confirmation": True, + "confirmation": packing_sublocation.barcode, }, ) # check data @@ -345,7 +345,7 @@ def test_unload_set_destination_partially_available_backorder(self): params={ "package_id": self.free_package.id, "barcode": packing_sublocation.barcode, - "confirmation": True, + "confirmation": packing_sublocation.barcode, }, ) # check data diff --git a/shopfloor_checkout_sync/tests/test_shopfloor_zone_picking_sync.py b/shopfloor_checkout_sync/tests/test_shopfloor_zone_picking_sync.py index 93dd5242a6..de5e2f3377 100644 --- a/shopfloor_checkout_sync/tests/test_shopfloor_zone_picking_sync.py +++ b/shopfloor_checkout_sync/tests/test_shopfloor_zone_picking_sync.py @@ -64,7 +64,7 @@ def test_unload_set_destination_sync(self): params={ "package_id": self.free_package.id, "barcode": self.packing_sublocation.barcode, - "confirmation": True, + "confirmation": self.packing_sublocation.barcode, }, ) # check data diff --git a/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js b/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js index b99d3b2c32..00cc01b6a7 100644 --- a/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js +++ b/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js @@ -350,7 +350,7 @@ const ClusterPicking = { title: this.$t("cluster_picking.unload_all.title"), scan_placeholder: this.$t("scan_placeholder_translation"), }, - on_scan: (scanned, confirmation = false) => { + on_scan: (scanned, confirmation = "") => { this.state_set_data({location_barcode: scanned.text}); this.wait_call( this.odoo.call("set_destination_all", { @@ -366,23 +366,12 @@ const ClusterPicking = { title: this.$t("cluster_picking.confirm_unload_all.title"), scan_placeholder: this.$t("scan_placeholder_translation"), }, - on_user_confirm: (answer) => { - // TODO: check if this used - // -> no flag is set to enable the confirmation dialog, - // we only display a message, unlike `confirm_start` - if (answer == "yes") { - // Reuse data from unload_all - const scan_data = this.state_get_data("unload_all"); - this.state.on_scan(scan_data.location_barcode, true); - } else { - this.state_to("scan_destination"); - } - }, on_scan: (scanned, confirmation = true) => { this.on_state_exit(); // FIXME: use state_load or traverse the state // this.current_state_key = "unload_all"; // this.state.on_scan(scanned, confirmation); + confirmation = this.state.data.confirmation || ""; this.states.unload_all.on_scan(scanned, confirmation); }, }, @@ -429,7 +418,7 @@ const ClusterPicking = { picking_batch_id: this.current_batch().id, package_id: null, // FIXME: where does it come from? backend data? barcode: scanned.text, - confirmation: true, + confirmation: this.state.data.confirmation || "", }) ); }, diff --git a/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js b/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js index 123e0042c3..c5246af8d0 100644 --- a/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js +++ b/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js @@ -274,7 +274,7 @@ const LocationContentTransfer = { this.odoo.call("set_destination_all", { location_id: data.location.id, barcode: scanned.text, - confirmation: data.confirmation_required, + confirmation: data.confirmation_required || "", }) ); }, @@ -337,7 +337,7 @@ const LocationContentTransfer = { package_level_id: data.package_level.id, location_id: data.package_level.location_src.id, barcode: scanned.text, - confirmation: data.confirmation_required, + confirmation: data.confirmation_required || "", }; } else { endpoint = "set_destination_line"; @@ -345,7 +345,7 @@ const LocationContentTransfer = { move_line_id: data.move_line.id, location_id: data.move_line.location_src.id, barcode: scanned.text, - confirmation: data.confirmation_required, + confirmation: data.confirmation_required || "", quantity: this.scan_destination_qty, }; } diff --git a/shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js b/shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js index 77c2c0116f..9a4f17e9ec 100644 --- a/shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js +++ b/shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js @@ -24,7 +24,7 @@ export var SinglePackStatesMixin = { this.wait_call( this.odoo.call("start", { barcode: scanned.text, - confirmation: data.confirmation_required, + confirmation: data.confirmation_required || "", }) ); }, @@ -43,7 +43,7 @@ export var SinglePackStatesMixin = { package_level_id: data.id, location_barcode: scanned.text, confirmation: - confirmation || data.confirmation_required, + confirmation || data.confirmation_required || "", }) ); }, diff --git a/shopfloor_mobile/static/wms/src/scenario/zone_picking.js b/shopfloor_mobile/static/wms/src/scenario/zone_picking.js index 6cc71f5bdb..23427d1d38 100644 --- a/shopfloor_mobile/static/wms/src/scenario/zone_picking.js +++ b/shopfloor_mobile/static/wms/src/scenario/zone_picking.js @@ -596,7 +596,7 @@ const ZonePicking = { scan_source(barcode) { let data = { barcode: barcode, - confirmation: this.state.data.confirmation_required, + confirmation: this.state.data.confirmation_required || "", }; if (this.state_is("select_line") && this.state.data.product) { data.product_id = this.state.data.product.id; @@ -888,7 +888,7 @@ const ZonePicking = { move_line_id: data.move_line.id, barcode: scanned.text, quantity: quantity, - confirmation: data.confirmation_required, + confirmation: data.confirmation_required || "", // package_id: data.is_complete_mix_pack ? data.move_line.package_src.id : null, handle_complete_mix_pack: data.handle_complete_mix_pack, }) @@ -918,7 +918,8 @@ const ZonePicking = { this.wait_call( this.odoo.call("set_destination_all", { barcode: scanned.text, - confirmation: this.state.data.confirmation_required, + confirmation: + this.state.data.confirmation_required || "", }) ); }, @@ -950,7 +951,8 @@ const ZonePicking = { this.odoo.call("unload_set_destination", { package_id: this.state.data.move_line.package_dest.id, barcode: scanned.text, - confirmation: this.state.data.confirmation_required, + confirmation: + this.state.data.confirmation_required || "", }) ); },