mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Remove details about stock in line_item_syncer so that we avoid confusing the user with stock numbers, this way the user will know what is the problem and can check stock levels and the order for more details
This commit is contained in:
@@ -76,9 +76,9 @@ class LineItemSyncer
|
||||
|
||||
def stock_issue_description(line_item)
|
||||
if line_item.variant.in_stock?
|
||||
I18n.t("spree.orders.line_item.insufficient_stock", on_hand: line_item.variant.on_hand)
|
||||
I18n.t("admin.subscriptions.stock.insufficient_stock")
|
||||
else
|
||||
I18n.t("spree.orders.line_item.out_of_stock")
|
||||
I18n.t("admin.subscriptions.stock..out_of_stock")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1076,6 +1076,9 @@ en:
|
||||
saving: "SAVING"
|
||||
saved: "SAVED"
|
||||
product_already_in_order: This product has already been added to the order. Please edit the quantity directly.
|
||||
stock:
|
||||
insufficient_stock: "Insufficient stock available"
|
||||
out_of_stock: "Out of Stock"
|
||||
orders:
|
||||
number: Number
|
||||
confirm_edit: Are you sure you want to edit this order? Doing so may make it more difficult to automatically sync changes to the subscription in the future.
|
||||
|
||||
@@ -416,8 +416,7 @@ describe OrderSyncer do
|
||||
expect(line_items.map(&:quantity)).to eq [1]
|
||||
expect(order.reload.total.to_f).to eq 59.97
|
||||
line_item = order.line_items.find_by_variant_id(sli.variant_id)
|
||||
# when we complete the order in this test case, the one item in the original order is taken from stock, this moved the available stock to 1
|
||||
expect(syncer.order_update_issues[order.id]).to include "#{line_item.product.name} - #{line_item.variant.full_name} - Insufficient stock available, only 1 remaining"
|
||||
expect(syncer.order_update_issues[order.id]).to include "#{line_item.product.name} - #{line_item.variant.full_name} - Insufficient stock available"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -502,7 +501,7 @@ describe OrderSyncer do
|
||||
line_items = Spree::LineItem.where(order_id: subscription.orders, variant_id: variant.id)
|
||||
expect(line_items.map(&:quantity)).to eq [0]
|
||||
expect(order.reload.total.to_f).to eq 59.97
|
||||
expect(syncer.order_update_issues[order.id]).to include "#{variant.product.name} - #{variant.full_name} - Insufficient stock available, only 5 remaining"
|
||||
expect(syncer.order_update_issues[order.id]).to include "#{variant.product.name} - #{variant.full_name} - Insufficient stock available"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user