From e1e417b5f769bb5740bb173b2f023450c2ca1c52 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/__manifest__.py | 2 +- .../i18n/stock_vertical_lift.pot | 17 +++++++ 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 | 36 ++++++++++----- stock_vertical_lift/tests/test_pick.py | 34 ++++++++++++++ .../vertical_lift_operation_base_views.xml | 9 ++++ 11 files changed, 193 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/__manifest__.py b/stock_vertical_lift/__manifest__.py index b8daf3556..fc1e1e825 100644 --- a/stock_vertical_lift/__manifest__.py +++ b/stock_vertical_lift/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Vertical Lift", "summary": "Provides the core for integration with Vertical Lifts", - "version": "13.0.1.1.3", + "version": "13.0.1.2.0", "category": "Stock", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", diff --git a/stock_vertical_lift/i18n/stock_vertical_lift.pot b/stock_vertical_lift/i18n/stock_vertical_lift.pot index 7de322c38..776c13526 100644 --- a/stock_vertical_lift/i18n/stock_vertical_lift.pot +++ b/stock_vertical_lift/i18n/stock_vertical_lift.pot @@ -228,6 +228,13 @@ msgstr "" msgid "ID" msgstr "" +#. module: stock_vertical_lift +#: model:ir.model.fields,help:stock_vertical_lift.field_stock_move_line__vertical_lift_skipped +msgid "" +"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." +msgstr "" + #. module: stock_vertical_lift #: model:ir.model.fields,field_description:stock_vertical_lift.field_vertical_lift_operation_inventory__inventory_id #: model:ir.model.fields.selection,name:stock_vertical_lift.selection__vertical_lift_shuttle__mode__inventory @@ -590,6 +597,16 @@ msgstr "" msgid "Shuttle Name" msgstr "" +#. module: stock_vertical_lift +#: model_terms:ir.ui.view,arch_db:stock_vertical_lift.vertical_lift_operation_base_screen_view +msgid "Skip" +msgstr "" + +#. module: stock_vertical_lift +#: model:ir.model.fields,field_description:stock_vertical_lift.field_stock_move_line__vertical_lift_skipped +msgid "Skipped in Vertical Lift?" +msgstr "" + #. module: stock_vertical_lift #: model:ir.model.fields,field_description:stock_vertical_lift.field_vertical_lift_operation_pick__picking_origin #: model:ir.model.fields,field_description:stock_vertical_lift.field_vertical_lift_operation_put__picking_origin 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..c2394ad2c 100644 --- a/stock_vertical_lift/static/description/index.html +++ b/stock_vertical_lift/static/description/index.html @@ -386,14 +386,16 @@ Only for development or testing purpose, do not use in production.
  • Tray types
  • Vertical Lift Shuttles
  • Put-away configuration
  • +
  • Barcodes
  • -
  • Known issues / Roadmap
  • -
  • Bug Tracker
  • -
  • Credits @@ -448,9 +450,19 @@ 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

    +

    Known issues / Roadmap

    • Complete screen workflows (currently enough for a demo, not for production)
    • Inventory: find a way to have a nice autofocus for quantity, still compatible @@ -463,7 +475,7 @@ makes sense)
    -

    Bug Tracker

    +

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed @@ -471,21 +483,21 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    Do not contact contributors directly about support or help with technical issues.

    -

    Credits

    +

    Credits

    -

    Authors

    +

    Authors

    • Camptocamp
    -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association

    OCA, or the Odoo Community Association, is a nonprofit organization whose diff --git a/stock_vertical_lift/tests/test_pick.py b/stock_vertical_lift/tests/test_pick.py index 1d4d3b4f2..e482f69da 100644 --- a/stock_vertical_lift/tests/test_pick.py +++ b/stock_vertical_lift/tests/test_pick.py @@ -37,6 +37,15 @@ class TestPick(VerticalLiftCase): self.assertEqual(operation.current_move_line_id, self.out_move_line) self.assertEqual(operation.state, "scan_destination") + def test_pick_select_next_move_line_was_skipped(self): + """Previously skipped moves can be reprocessed""" + self.picking_out.move_line_ids.write({"vertical_lift_skipped": True}) + operation = self._open_screen("pick") + operation.select_next_move_line() + self.assertEqual(operation.current_move_line_id, self.out_move_line) + self.assertEqual(operation.state, "scan_destination") + self.assertFalse(operation.current_move_line_id.vertical_lift_skipped) + def test_pick_save(self): operation = self._open_screen("pick") # assume we already scanned the destination, current state is save @@ -46,6 +55,31 @@ class TestPick(VerticalLiftCase): self.assertEqual(operation.current_move_line_id.state, "done") self.assertEqual(operation.state, "release") + def test_pick_skip_from_scan_destination(self): + """Being in state Scan Destination, skip it""" + self._test_pick_skip_from_state("scan_destination") + + def test_pick_skip_from_save(self): + """Being in state Save, skip it""" + self._test_pick_skip_from_state("save") + + def test_pick_skip_from_release(self): + """Being in state Release, skip it""" + self._test_pick_skip_from_state("release") + + def _test_pick_skip_from_state(self, state): + operation = self._open_screen("pick") + operation.state = state + operation.current_move_line_id = self.out_move_line + first_move_line = operation.current_move_line_id + self.assertFalse(operation.current_move_line_id.vertical_lift_skipped) + operation.button_skip() + second_move_line = operation.current_move_line_id + self.assertNotEqual(first_move_line, second_move_line) + self.assertFalse(operation.current_move_line_id.vertical_lift_skipped) + self.assertEqual(operation.current_move_line_id.state, "assigned") + self.assertEqual(operation.state, "scan_destination") + def test_pick_related_fields(self): operation = self._open_screen("pick") ml = operation.current_move_line_id = self.out_move_line diff --git a/stock_vertical_lift/views/vertical_lift_operation_base_views.xml b/stock_vertical_lift/views/vertical_lift_operation_base_views.xml index 079653691..40c4b405e 100644 --- a/stock_vertical_lift/views/vertical_lift_operation_base_views.xml +++ b/stock_vertical_lift/views/vertical_lift_operation_base_views.xml @@ -65,6 +65,15 @@

    +