From b8ec319bcc785056250acbc05919ac2f7206bb53 Mon Sep 17 00:00:00 2001 From: Thierry Ducrest Date: Tue, 14 Nov 2023 15:55:00 +0100 Subject: [PATCH 01/16] shopfloor: checkout fix asking destination location There could be multiple moves with different destination The destination location could be of type `view` For both cases, require the user to scan a new location. --- shopfloor/services/checkout.py | 7 ++----- shopfloor/tests/test_checkout_done.py | 28 ++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/shopfloor/services/checkout.py b/shopfloor/services/checkout.py index 01b8b6c81b..1aae3754b1 100644 --- a/shopfloor/services/checkout.py +++ b/shopfloor/services/checkout.py @@ -1404,11 +1404,8 @@ def done(self, picking_id, confirmation=False): }, ) lines_done = self._lines_checkout_done(picking) - dest_location = picking.location_dest_id - child_locations = self.env["stock.location"].search( - [("id", "child_of", dest_location.id), ("usage", "!=", "view")] - ) - if len(child_locations) > 0 and child_locations != dest_location: + dest_location = lines_done.move_id.location_dest_id + if len(dest_location) != 1 or dest_location.usage == "view": return self._response_for_select_child_location( picking, ) diff --git a/shopfloor/tests/test_checkout_done.py b/shopfloor/tests/test_checkout_done.py index a9acce2032..1e6c93c3aa 100644 --- a/shopfloor/tests/test_checkout_done.py +++ b/shopfloor/tests/test_checkout_done.py @@ -65,8 +65,34 @@ def test_done_partial_confirm(self): "done", params={"picking_id": self.picking.id, "confirmation": True} ) - self.assertRecordValues(self.picking, [{"state": "assigned"}]) + self.assertRecordValues(self.picking, [{"state": "done"}]) + + self.assert_response( + response, + next_state="select_document", + message=self.service.msg_store.transfer_done_success(self.picking), + data={"restrict_scan_first": False}, + ) + def test_done_ask_destination_location(self): + """Check asking for destination location for view type location.""" + view_location = ( + self.env["stock.location"] + .sudo() + .create( + { + "name": "Test Location Usage View", + "location_id": self.picking.move_lines.location_dest_id.id, + "usage": "view", + } + ) + ) + self.picking.move_lines.location_dest_id = view_location + response = self.service.dispatch( + "done", params={"picking_id": self.picking.id, "confirmation": True} + ) + + self.assertRecordValues(self.picking, [{"state": "assigned"}]) self.assert_response( response, next_state="select_child_location", From 3dddd879cbbff4a2f9934ec8b12a9cc6035db378 Mon Sep 17 00:00:00 2001 From: JuMiSanAr Date: Mon, 16 Oct 2023 16:16:03 +0200 Subject: [PATCH 02/16] shopfloor_mobile_base: fix searchbar focus --- .../static/wms/src/components/searchbar/searchbar.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/shopfloor_mobile_base/static/wms/src/components/searchbar/searchbar.js b/shopfloor_mobile_base/static/wms/src/components/searchbar/searchbar.js index bed590947f..381f6cb851 100644 --- a/shopfloor_mobile_base/static/wms/src/components/searchbar/searchbar.js +++ b/shopfloor_mobile_base/static/wms/src/components/searchbar/searchbar.js @@ -115,7 +115,15 @@ export var Searchbar = Vue.component("searchbar", { }, methods: { capture_focus: function () { - if (this.autofocus) this.$refs.searchbar.focus(); + if (this.autofocus && this.$refs.searchbar) { + // We need to use both "focus" and "click" in combination + // to make sure that the searchbar is fully focused and ready for scanning + // without having to manually tap on it. + // Using simply one or the other is not enough + // to always be able to input any scanned text. + this.$refs.searchbar.focus(); + this.$refs.searchbar.click(); + } }, show_virtual_keyboard: function (elem) { elem.inputMode = this.input_inputmode; From c0392b7930e6a8666a0d5cdcc0c1db4a692faeb2 Mon Sep 17 00:00:00 2001 From: JuMiSanAr Date: Thu, 9 Nov 2023 14:53:36 +0100 Subject: [PATCH 03/16] shopfloor_mobile: ensure searchbar focus doesn't remove user popups --- .../static/wms/src/scenario/cluster_picking.js | 3 +++ .../src/scenario/location_content_transfer.js | 3 +++ .../wms/src/scenario/single_pack_transfer.js | 17 +++++++++++++++-- .../static/wms/src/scenario/zone_picking.js | 3 +++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js b/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js index b85426a68a..b99d3b2c32 100644 --- a/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js +++ b/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js @@ -7,6 +7,8 @@ import {ScenarioBaseMixin} from "/shopfloor_mobile_base/static/wms/src/scenario/mixins.js"; import {process_registry} from "/shopfloor_mobile_base/static/wms/src/services/process_registry.js"; +// TODO: consider replacing the dynamic "autofocus" in the searchbar by an event. +// At the moment, we need autofocus to be disabled if there's a user popup. const ClusterPicking = { mixins: [ScenarioBaseMixin], template: ` @@ -18,6 +20,7 @@ const ClusterPicking = { v-if="state.on_scan" v-on:found="on_scan" :input_placeholder="search_input_placeholder" + :autofocus="!screen_info.user_popup" /> - - + +