mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-07 22:46:06 +00:00
Add order.shipments reload to line_item.update_inventory. This is necessary when destroying line items as update_inventory may delete the shipment from the order
This commit is contained in:
@@ -132,6 +132,10 @@ Spree::LineItem.class_eval do
|
||||
def update_inventory_with_scoping
|
||||
scoper.scope(variant)
|
||||
update_inventory_without_scoping
|
||||
|
||||
# This is required because update_inventory may delete the last shipment in the order
|
||||
# and that makes update_order fail if we don't reload the shipments relation here
|
||||
order.shipments.reload
|
||||
end
|
||||
alias_method_chain :update_inventory, :scoping
|
||||
|
||||
|
||||
Reference in New Issue
Block a user