From c16a5e308b5c2ef51e6dc9e9825049579a96c7db Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Fri, 3 Jul 2020 10:11:53 +0200 Subject: [PATCH] Ignore storage types constraints on quants in cells When the putaway selects a tray and a cell according to the storage type, we still want the user to be able to override the selection by scanning another tray type. --- .../models/__init__.py | 1 + .../models/stock_quant.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 stock_vertical_lift_storage_type/models/stock_quant.py diff --git a/stock_vertical_lift_storage_type/models/__init__.py b/stock_vertical_lift_storage_type/models/__init__.py index 029c1ede2..cb2169a09 100644 --- a/stock_vertical_lift_storage_type/models/__init__.py +++ b/stock_vertical_lift_storage_type/models/__init__.py @@ -1,3 +1,4 @@ from . import stock_location from . import stock_location_tray_type +from . import stock_quant from . import vertical_lift_operation_put diff --git a/stock_vertical_lift_storage_type/models/stock_quant.py b/stock_vertical_lift_storage_type/models/stock_quant.py new file mode 100644 index 000000000..90994ee81 --- /dev/null +++ b/stock_vertical_lift_storage_type/models/stock_quant.py @@ -0,0 +1,18 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo import models + + +class StockQuant(models.Model): + + _inherit = "stock.quant" + + def _check_storage_type(self): + # disable the checks when placing goods in vertical lift cells: + # we still want to benefit of the storage type rules to select + # a destination, but we want to allow selecting a different tray + # type + self = self.filtered( + lambda quant: quant.location_id.vertical_lift_kind != "cell" + ) + super()._check_storage_type()