Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] shopfloor zone picking improve select_line endpoint/state #727

Merged
merged 2 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shopfloor/services/zone_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
21 changes: 19 additions & 2 deletions shopfloor/tests/test_zone_picking_select_line_no_prefill_qty.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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):
Expand Down
58 changes: 51 additions & 7 deletions shopfloor_mobile/static/wms/src/scenario/zone_picking.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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: {
Expand Down
Loading