Don't decrement variant stock if override is on_demand

This commit is contained in:
Matt-Yorkley
2019-08-05 12:59:47 +01:00
parent b0f90cf43c
commit 4c7d3a491a

View File

@@ -41,7 +41,11 @@ module OpenFoodNetwork
# - updates variant_override.count_on_hand
# - does not create stock_movement
# - does not update stock_item.count_on_hand
# If it is a variant override with on_demand:
# - don't change stock or call super (super would change the variant's stock)
def move(quantity, originator = nil)
return if @variant_override.andand.on_demand
if @variant_override.andand.stock_overridden?
@variant_override.move_stock! quantity
else