mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge pull request #4987 from Matt-Yorkley/3-0-packing
[Spree 2.1] Packing report deleted variants
This commit is contained in:
@@ -247,7 +247,7 @@ module Spree
|
||||
end
|
||||
|
||||
def suppliers_of_products_distributed_by(distributors)
|
||||
distributors.map { |d| Spree::Product.in_distributor(d).includes(:supplier).all }.
|
||||
distributors.map { |d| Spree::Product.in_distributor(d).includes(:supplier).to_a }.
|
||||
flatten.map(&:supplier).uniq
|
||||
end
|
||||
|
||||
|
||||
@@ -71,9 +71,11 @@ Spree::LineItem.class_eval do
|
||||
where('spree_adjustments.id IS NULL')
|
||||
}
|
||||
|
||||
# Overridden so that LineItems always have access to soft-deleted Variant attributes
|
||||
# In some situations, unscoped super will be nil, in these cases we fetch the variant using the variant_id
|
||||
# See isssue #4946 for more details
|
||||
def variant
|
||||
# Overridden so that LineItems always have access to soft-deleted Variant attributes
|
||||
Spree::Variant.unscoped { super }
|
||||
Spree::Variant.unscoped { super } || Spree::Variant.unscoped.find(self.variant_id)
|
||||
end
|
||||
|
||||
def cap_quantity_at_stock!
|
||||
|
||||
@@ -21,7 +21,7 @@ module OpenFoodNetwork
|
||||
end
|
||||
|
||||
if line_item_includes.present?
|
||||
line_items = line_items.includes(*line_item_includes)
|
||||
line_items = line_items.includes(*line_item_includes).references(:line_items)
|
||||
end
|
||||
|
||||
editable_line_items = editable_line_items(line_items)
|
||||
|
||||
Reference in New Issue
Block a user