mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-03 06:59:14 +00:00
Render only eligible adjustments on the order page
https://github.com/openfoodfoundation/openfoodnetwork/issues/3477 The admin orders edit form was displaying adjustments even if they were "not eligible". For example, an additional fee with amount `0` is not eligible. They were already hidden in the adjustments view and we are hiding them in reports.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
= render :partial => "spree/admin/orders/shipment", :collection => @order.shipments, :locals => { :order => order }
|
||||
|
||||
= render :partial => "spree/admin/orders/_form/adjustments", :locals => { :adjustments => @order.price_adjustments, :order => order, :title => Spree.t(:line_item_adjustments)}
|
||||
= render :partial => "spree/admin/orders/_form/adjustments", :locals => { :adjustments => @order.adjustments, :order => order, :title => Spree.t(:order_adjustments)}
|
||||
= render :partial => "spree/admin/orders/_form/adjustments", :locals => { :adjustments => @order.adjustments.eligible, :order => order, :title => Spree.t(:order_adjustments)}
|
||||
|
||||
- if order.line_items.exists?
|
||||
%fieldset#order-total.no-border-bottom{"data-hook" => "order_details_total"}
|
||||
|
||||
@@ -283,6 +283,19 @@ feature %q{
|
||||
end
|
||||
end
|
||||
|
||||
scenario "shows only eligible adjustments" do
|
||||
adjustment = create(
|
||||
:adjustment,
|
||||
adjustable: @order,
|
||||
label: "invalid adjustment",
|
||||
amount: 0
|
||||
)
|
||||
|
||||
visit spree.edit_admin_order_path(@order)
|
||||
|
||||
expect(page).to have_no_content adjustment.label
|
||||
end
|
||||
|
||||
scenario "cannot split the order in different stock locations" do
|
||||
# There's only 1 stock location in OFN, so the split functionality that comes with spree should be hidden
|
||||
expect(page).to_not have_selector '.split-item'
|
||||
|
||||
Reference in New Issue
Block a user