Add stock_vertical_lift_storage_type

Compatibility module between stock_vertical_lift and stock_storage_type
(in OCA/wms).

In the vertical lift's Putaway screen, when a good is scanned for a putaway, the
user has to scan the tray type of the corresponding size, so an empty place in a
matching tray is found. When we use storage types, we should know what tray is
compatible with the storage type.

Changes with this module:

* The storage types of trays cannot be selected in the locations form, they have
  to be set in the Tray types.
* In the lift put-away screen, when a package has a storage type, the user isn't
  asked to scan a tray type, instead, the putaway of the Package Storage Type is
  applied.
This commit is contained in:
Guewen Baconnier
2020-07-02 08:24:49 +02:00
committed by Hai Lang
parent 7d78e8b540
commit abdde7cbf5
2 changed files with 12 additions and 5 deletions

View File

@@ -65,9 +65,6 @@ class VerticalLiftOperationPut(models.Model):
_("No move line found for barcode {}").format(barcode) _("No move line found for barcode {}").format(barcode)
) )
# TODO if the move line already has a storage type, assign directly a
# destination and save
elif self.step() == "scan_tray_type": elif self.step() == "scan_tray_type":
tray_type = self._find_tray_type(barcode) tray_type = self._find_tray_type(barcode)
if tray_type: if tray_type:

View File

@@ -48,8 +48,18 @@ class VerticalLiftCase(common.LocationTrayTypeCase):
"stock_vertical_lift." "stock_location_vertical_lift_demo_tray_2a_x1y1" "stock_vertical_lift." "stock_location_vertical_lift_demo_tray_2a_x1y1"
) )
def _update_qty_in_location(self, location, product, quantity): @classmethod
self.env["stock.quant"]._update_available_quantity(product, location, quantity) def _update_qty_in_location(
cls, location, product, quantity, package=None, lot=None
):
quants = cls.env["stock.quant"]._gather(
product, location, lot_id=lot, package_id=package, strict=True
)
# this method adds the quantity to the current quantity, so remove it
quantity -= sum(quants.mapped("quantity"))
cls.env["stock.quant"]._update_available_quantity(
product, location, quantity, package_id=package, lot_id=lot
)
def _open_screen(self, mode, shuttle=None): def _open_screen(self, mode, shuttle=None):
getattr(shuttle or self.shuttle, "switch_{}".format(mode))() getattr(shuttle or self.shuttle, "switch_{}".format(mode))()