From cd65caff20aab67bcf57db8df56ef8da9a98aae8 Mon Sep 17 00:00:00 2001 From: Carlos Serra-Toro Date: Mon, 25 Jan 2021 10:22:00 +0100 Subject: [PATCH] [IMP] stock_vertical_lift: Add skip operation to vertical lift shuttles In the screen for the vertical lift shuttles, accessible through Inventory > Operations > Vertical Lift Shuttles, a new button has been added to allow to skip an operation. This button can also be triggered by scanning the barcode O-BTN.skip.svg that is inside the folder 'images'. When a skip is done, the next stock.move.line to pick is chosen and shown to the operator. A skipped move line is added to the end of the list of pending move lines to be picked, so they will be shown again in the future as soon as the other move lines have been successfully processed. This option was added because, sometimes, the operator can not process a move line for whatever reason. Right now, the only way of proceeding is to wait until he/she can effectively process it, which involves a delay in the operations. With this new skip operation, the operator can continue processing the rest of move lines. --- stock_vertical_lift/README.rst | 12 +++++ stock_vertical_lift/images/O-BTN.skip.svg | 46 +++++++++++++++++++ stock_vertical_lift/models/stock_move_line.py | 10 +++- .../models/vertical_lift_operation_pick.py | 34 +++++++++++++- stock_vertical_lift/readme/CONFIGURE.rst | 7 +++ stock_vertical_lift/readme/DEVELOP.rst | 1 + .../static/description/index.html | 38 +++++++++------ stock_vertical_lift/tests/test_pick.py | 34 ++++++++++++++ .../vertical_lift_operation_base_views.xml | 9 ++++ 9 files changed, 176 insertions(+), 15 deletions(-) create mode 100644 stock_vertical_lift/images/O-BTN.skip.svg create mode 100644 stock_vertical_lift/readme/DEVELOP.rst diff --git a/stock_vertical_lift/README.rst b/stock_vertical_lift/README.rst index 129691794..cb8943930 100644 --- a/stock_vertical_lift/README.rst +++ b/stock_vertical_lift/README.rst @@ -91,6 +91,18 @@ so when they arrive in WH/Stock, they are stored in WH/Stock/Vertical Lift. On the put-away screen, when scanning the tray type to store, the destination will be updated with an available cell of the same tray type in the current shuttle. +Barcodes +~~~~~~~~ + +The operations allowed in the screen for the vertical lift (save, release, skip) +can be triggered using a barcode. For this, print the barcodes contained in the +folder 'images'. + +Development +=========== + +The barcodes used are of the type Code 128 (with the code set B). + Known issues / Roadmap ====================== diff --git a/stock_vertical_lift/images/O-BTN.skip.svg b/stock_vertical_lift/images/O-BTN.skip.svg new file mode 100644 index 000000000..b7c96cf41 --- /dev/null +++ b/stock_vertical_lift/images/O-BTN.skip.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +O-BTN.skip diff --git a/stock_vertical_lift/models/stock_move_line.py b/stock_vertical_lift/models/stock_move_line.py index 433d6f33d..7f0b83aae 100644 --- a/stock_vertical_lift/models/stock_move_line.py +++ b/stock_vertical_lift/models/stock_move_line.py @@ -1,12 +1,20 @@ # Copyright 2019 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models +from odoo import fields, models class StockMoveLine(models.Model): _inherit = "stock.move.line" + vertical_lift_skipped = fields.Boolean( + "Skipped in Vertical Lift?", + default=False, + help="If this flag is set, it means that when the move " + "was being processed in the Vertical Lift, the operator decided to " + "skip its processing.", + ) + def fetch_vertical_lift_tray_source(self): self.ensure_one() self.location_id.fetch_vertical_lift_tray() diff --git a/stock_vertical_lift/models/vertical_lift_operation_pick.py b/stock_vertical_lift/models/vertical_lift_operation_pick.py index b7f11ade7..217a36c85 100644 --- a/stock_vertical_lift/models/vertical_lift_operation_pick.py +++ b/stock_vertical_lift/models/vertical_lift_operation_pick.py @@ -17,6 +17,7 @@ class VerticalLiftOperationPick(models.Model): ("scan_destination", "Scan New Destination Location"), ("save", "Pick goods and save"), ("release", "Release"), + ("skip", "Skip"), # Virtual state. ] def _transitions(self): @@ -24,15 +25,30 @@ class VerticalLiftOperationPick(models.Model): self.Transition( "noop", "scan_destination", lambda self: self.select_next_move_line() ), + self.Transition("scan_destination", "skip", lambda self: self.is_skipped()), self.Transition("scan_destination", "save"), + self.Transition("save", "skip", lambda self: self.is_skipped()), self.Transition("save", "release", lambda self: self.process_current()), + self.Transition("release", "skip", lambda self: self.is_skipped()), # go to scan_destination if we have lines in queue, otherwise, go to noop self.Transition( "release", "scan_destination", lambda self: self.select_next_move_line() ), self.Transition("release", "noop"), + self.Transition( + "skip", + "scan_destination", + lambda self: self.select_next_move_line(), + direct_eval=True, + ), + self.Transition("skip", "noop", direct_eval=True), ) + def is_skipped(self): + """Was the current stock.move.line marked as to be skipped?""" + self.ensure_one() + return self.current_move_line_id.vertical_lift_skipped + def on_barcode_scanned(self, barcode): self.ensure_one() if not self.current_move_line_id or self.current_move_line_id.state == "done": @@ -69,11 +85,20 @@ class VerticalLiftOperationPick(models.Model): def select_next_move_line(self): self.ensure_one() + next_move_line_order = "vertical_lift_skipped" + if self._order: + # If there already exists an order, keep it. + next_move_line_order += "," + self._order next_move_line = self.env["stock.move.line"].search( - self._domain_move_lines_to_do(), limit=1 + self._domain_move_lines_to_do(), limit=1, order=next_move_line_order ) self.current_move_line_id = next_move_line if next_move_line: + if next_move_line.vertical_lift_skipped: + # If a move line that was previously skipped was selected, + # we allow to process it again (maybe this time it's not + # skipped). + next_move_line.vertical_lift_skipped = False self.fetch_tray() return True return False @@ -88,3 +113,10 @@ class VerticalLiftOperationPick(models.Model): self.shuttle_id.release_vertical_lift_tray() # sorry not sorry return self._rainbow_man() + + def button_skip(self): + """Skip the operation, go to the next""" + self.ensure_one() + self.current_move_line_id.vertical_lift_skipped = True + if self.step() != "noop": + self.next_step() diff --git a/stock_vertical_lift/readme/CONFIGURE.rst b/stock_vertical_lift/readme/CONFIGURE.rst index 0a3bdb04b..e66eca827 100644 --- a/stock_vertical_lift/readme/CONFIGURE.rst +++ b/stock_vertical_lift/readme/CONFIGURE.rst @@ -46,3 +46,10 @@ vertical lift view as destination. E.g. create put-away rules on the products so when they arrive in WH/Stock, they are stored in WH/Stock/Vertical Lift. On the put-away screen, when scanning the tray type to store, the destination will be updated with an available cell of the same tray type in the current shuttle. + +Barcodes +~~~~~~~~ + +The operations allowed in the screen for the vertical lift (save, release, skip) +can be triggered using a barcode. For this, print the barcodes contained in the +folder 'images'. diff --git a/stock_vertical_lift/readme/DEVELOP.rst b/stock_vertical_lift/readme/DEVELOP.rst new file mode 100644 index 000000000..b6178892d --- /dev/null +++ b/stock_vertical_lift/readme/DEVELOP.rst @@ -0,0 +1 @@ +The barcodes used are of the type Code 128 (with the code set B). diff --git a/stock_vertical_lift/static/description/index.html b/stock_vertical_lift/static/description/index.html index b3985355a..bcf968891 100644 --- a/stock_vertical_lift/static/description/index.html +++ b/stock_vertical_lift/static/description/index.html @@ -3,7 +3,7 @@ - + Vertical Lift