From a09c2fccca703c4bf788784cfb21d1fa65177bde Mon Sep 17 00:00:00 2001 From: rahul-bash Date: Tue, 22 Aug 2023 11:57:56 +0530 Subject: [PATCH] fixed issue of parts not restocking back after line item destroy. --- app/models/spree/line_item_decorator.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/models/spree/line_item_decorator.rb b/app/models/spree/line_item_decorator.rb index 8744c4af..5a2dc0b8 100644 --- a/app/models/spree/line_item_decorator.rb +++ b/app/models/spree/line_item_decorator.rb @@ -52,6 +52,14 @@ def quantity_without_part_line_items(quantity) hash[ap.part] = ap.count * quantity end end + + def verify_order_inventory_before_destroy + if product.assembly? + Spree::OrderInventoryAssembly.new(self).verify(target_shipment) + else + Spree::OrderInventory.new(order, self).verify(target_shipment) + end + end end Spree::LineItem.prepend Spree::LineItemDecorator