diff --git a/stock_vertical_lift/models/vertical_lift_operation_put.py b/stock_vertical_lift/models/vertical_lift_operation_put.py index 4511359c3..886575b86 100644 --- a/stock_vertical_lift/models/vertical_lift_operation_put.py +++ b/stock_vertical_lift/models/vertical_lift_operation_put.py @@ -65,9 +65,6 @@ class VerticalLiftOperationPut(models.Model): _("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": tray_type = self._find_tray_type(barcode) if tray_type: diff --git a/stock_vertical_lift/tests/common.py b/stock_vertical_lift/tests/common.py index 89ec8999e..717134df7 100644 --- a/stock_vertical_lift/tests/common.py +++ b/stock_vertical_lift/tests/common.py @@ -48,8 +48,18 @@ class VerticalLiftCase(common.LocationTrayTypeCase): "stock_vertical_lift." "stock_location_vertical_lift_demo_tray_2a_x1y1" ) - def _update_qty_in_location(self, location, product, quantity): - self.env["stock.quant"]._update_available_quantity(product, location, quantity) + @classmethod + 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): getattr(shuttle or self.shuttle, "switch_{}".format(mode))()