From a551d5ced2fe41fc682be769dd1471aed328c9b1 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Thu, 28 May 2020 07:59:43 +0200 Subject: [PATCH] Remove implicit fallback when rules are used When rules are configured and have been applied, we should not have an implicit fallback on the base location, as it would kind of cancel the benefits of the rules (as it would then take whatever it wants anywhere in all the locations). --- stock_reserve_rule/models/stock_move.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/stock_reserve_rule/models/stock_move.py b/stock_reserve_rule/models/stock_move.py index 68d29e1b9..4b3915aa8 100644 --- a/stock_reserve_rule/models/stock_move.py +++ b/stock_reserve_rule/models/stock_move.py @@ -103,16 +103,7 @@ class StockMove(models.Model): break reserved = need - still_need - # Implicit fallback on the original location - return reserved + super()._update_reserved_quantity( - still_need, - available_quantity - reserved, - location_id=location_id, - lot_id=lot_id, - package_id=package_id, - owner_id=owner_id, - strict=strict, - ) + return reserved # We fall here if there is no rule or they have all been # excluded by 'rule._is_rule_applicable'