[ADD] stock_vertical_lift_empty_tray_check: is the tray empty?

A vertical lift retrieves a tray and places it in front of the
user, and depending on the quantity the user takes from it,
it adapts the pending quantity in the tray. However, because of
errors, it could be that the system thinks the tray is empty
while it is not. With this module, when the system thinks the
tray is empty, while in the step for the release of the tray
the operator is asked explicitly to check if the tray is
actually empty. Depending on his/her answer (yes/no) an inventory
adjustment is created stating the situation.

To activate this optional feature, a new configuration setting
has been added to Inventory > Configuration > Settings, named
'Check Empty Tray'. It is deactivated by default.

Developing decisions:
- The screens shown to the operator are actually wizards, but
  since in the original module (`stock_vertical_lift`) they
  were considered (on the source tree) as views, this has been
  continued here.
- It has been decided, to not change the current workflow of
  the operators, to embed the new check inside the step for
  the 'release'. So, a new screen is shown to ask for the
  visual inspection of whether the tray is empty. In
  order to test this easily, the method `button_release` of
  the module `stock_vertical_lift` has been slightly modified
  so that it always returns. This way we can check easily
  in the unit-tests for the outcome of the intermediate
  screen (i.e. wizard) ─ similarly to how it is done when
  validating a picking that can result in a backorder.
This commit is contained in:
Carlos Serra-Toro
2021-03-11 18:02:50 +01:00
committed by Hai Lang
parent eb0868f957
commit f7e7c8fbf0
3 changed files with 7 additions and 5 deletions

View File

@@ -303,7 +303,7 @@ class VerticalLiftOperationBase(models.AbstractModel):
self.ensure_one()
if not self.step() == "release":
return
self.next_step()
return self.next_step()
def _render_product_packagings(self, product):
if not product:

View File

@@ -105,14 +105,15 @@ class VerticalLiftOperationPick(models.Model):
def button_release(self):
"""Release the operation, go to the next"""
super().button_release()
res = super().button_release()
if self.step() == "noop":
# we don't need to release (close) the tray until we have reached
# the last line: the release is implicit when a next line is
# fetched
self.shuttle_id.release_vertical_lift_tray()
# sorry not sorry
return self._rainbow_man()
res = self._rainbow_man()
return res
def button_skip(self):
"""Skip the operation, go to the next"""

View File

@@ -172,11 +172,12 @@ class VerticalLiftOperationPut(models.Model):
self.current_move_line_id.fetch_vertical_lift_tray_dest()
def button_release(self):
super().button_release()
res = super().button_release()
if self.count_move_lines_to_do_all() == 0:
# we don't need to release (close) the tray until we have reached
# the last line: the release is implicit when a next line is
# fetched if the tray change
self.shuttle_id.release_vertical_lift_tray()
# sorry not sorry
return self._rainbow_man()
res = self._rainbow_man()
return res