scope variant to take overrides into account in packer

This commit is contained in:
Andy Brett
2021-04-22 11:45:12 -07:00
parent 9b52c453db
commit 56cf43f1c1

View File

@@ -15,9 +15,12 @@ module OrderManagement
order.line_items.each do |line_item|
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?
variant = line_item.variant
OpenFoodNetwork::ScopeVariantToHub.new(order.distributor).scope(variant)
on_hand, backordered = stock_location.fill_status(variant, line_item.quantity)
package.add variant, on_hand, :on_hand if on_hand.positive?
package.add variant, backordered, :backordered if backordered.positive?
end
package
end