diff --git a/shopfloor/services/zone_picking.py b/shopfloor/services/zone_picking.py index 716be37b53..d73283f13b 100644 --- a/shopfloor/services/zone_picking.py +++ b/shopfloor/services/zone_picking.py @@ -636,7 +636,7 @@ def _scan_source_package( message = self.msg_store.several_products_in_package(package) if packaging.package_has_several_lots(package): message = self.msg_store.several_lots_in_package(package) - if message: + if message or self.work.menu.no_prefill_qty: return ( self._list_move_lines( self.zone_location, diff --git a/shopfloor/tests/test_zone_picking_select_line_no_prefill_qty.py b/shopfloor/tests/test_zone_picking_select_line_no_prefill_qty.py index 86e074b686..34ac9dc526 100644 --- a/shopfloor/tests/test_zone_picking_select_line_no_prefill_qty.py +++ b/shopfloor/tests/test_zone_picking_select_line_no_prefill_qty.py @@ -32,8 +32,13 @@ def test_scan_source_barcode_location_no_prefill(self): ) def test_scan_source_barcode_package_no_prefill(self): - """When a package is scanned, qty_done in response is False.""" + """When a package is scanned. + + The user is required to scan a product. + Then redirected to the next screen, qty_done in response is False. + """ package = self.picking1.package_level_ids[0].package_id + # Scan package with one product response = self.service.dispatch( "scan_source", params={"barcode": package.name}, @@ -43,12 +48,24 @@ def test_scan_source_barcode_package_no_prefill(self): ) move_lines = move_lines.sorted(lambda l: l.move_id.priority, reverse=True) move_line = move_lines[0] + self.assert_response_select_line( + response, + self.zone_location, + self.picking1.picking_type_id, + move_lines, + package=package, + ) + # Scan the product + response = self.service.dispatch( + "scan_source", + params={"barcode": move_line.product_id.barcode}, + ) self.assert_response_set_line_destination( response, zone_location=self.zone_location, picking_type=self.picking_type, move_line=move_line, - qty_done=False, + qty_done=1.0, ) def test_scan_source_barcode_product_no_prefill(self): diff --git a/shopfloor_mobile/static/wms/src/scenario/zone_picking.js b/shopfloor_mobile/static/wms/src/scenario/zone_picking.js index cf17005ae8..9b6030c4a1 100644 --- a/shopfloor_mobile/static/wms/src/scenario/zone_picking.js +++ b/shopfloor_mobile/static/wms/src/scenario/zone_picking.js @@ -640,6 +640,30 @@ const ZonePicking = { } return false; }, + all_lines_with_package: function () { + const move_lines = this.state.data.move_lines; + if (!move_lines) { + return false; + } + for (let line_id = 0; line_id < move_lines.length; line_id++) { + if (!move_lines[line_id].package_src) { + return false; + } + } + return true; + }, + any_line_with_lot: function () { + const move_lines = this.state.data.move_lines; + if (!move_lines) { + return false; + } + for (let line_id = 0; line_id < move_lines.length; line_id++) { + if (move_lines[line_id].lot) { + return true; + } + } + return false; + }, }, computed: { sort_lines_by_btn_label() { @@ -737,16 +761,36 @@ const ZonePicking = { title: "Select move", scan_placeholder: () => { const sublocation = this.state.data.sublocation; - if ( - this.state.data.scan_location_or_pack_first && - !sublocation - ) { - return "Scan location / pack"; + const pack = this.state.data.package; + if (this.state.data.scan_location_or_pack_first) { + if (!pack && this.all_lines_with_package()) { + return "Scan pack"; + } + if (!sublocation && !pack) { + return "Scan location / pack"; + } + if (this.any_line_with_lot()) { + return "Scan product / lot"; + } + return "Scan product"; } if (sublocation) { - return "Scan product / lot / package"; + if (pack) { + if (this.any_line_with_lot()) { + return "Scan product / lot"; + } + return "Scan product"; + } else { + if (this.any_line_with_lot()) { + return "Scan pack / product / lot"; + } + return "Scan pack / product"; + } + } + if (this.any_line_with_lot()) { + return "Scan location / pack / product / lot"; } - return "Scan location / pack / product / lot"; + return "Scan location / pack / product"; }, }, events: {