Remove conditionals related to Config.track_inventory_levels, this config is always true in OFN

This commit is contained in:
Luis Ramos
2020-07-02 20:25:14 +01:00
parent ee937988e8
commit ff046f7a6c
2 changed files with 5 additions and 9 deletions

View File

@@ -172,7 +172,7 @@ module Spree
end
def line_items
if order.complete? && Spree::Config[:track_inventory_levels]
if order.complete?
order.line_items.select { |li| inventory_units.pluck(:variant_id).include?(li.variant_id) }
else
order.line_items

View File

@@ -17,15 +17,11 @@ module OrderManagement
def default_package
package = OrderManagement::Stock::Package.new(stock_location, order)
order.line_items.each do |line_item|
if Spree::Config.track_inventory_levels
next unless stock_location.stock_item(line_item.variant)
next unless stock_location.stock_item(line_item.variant)
on_hand, backordered = stock_location.fill_status(line_item.variant, line_item.quantity)
package.add line_item.variant, on_hand, :on_hand if on_hand.positive?
package.add line_item.variant, backordered, :backordered if backordered.positive?
else
package.add line_item.variant, line_item.quantity, :on_hand
end
on_hand, backordered = stock_location.fill_status(line_item.variant, line_item.quantity)
package.add line_item.variant, on_hand, :on_hand if on_hand.positive?
package.add line_item.variant, backordered, :backordered if backordered.positive?
end
package
end