Merge pull request #3666 from mkllnk/1830-v2-edit-shipping-fees

Close adjustments so that updates are effective
This commit is contained in:
Luis Ramos
2019-04-10 21:58:22 +01:00
committed by GitHub
2 changed files with 22 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ module Spree
AdjustmentsController.class_eval do
prepend_before_filter :set_included_tax, only: [:create, :update]
before_filter :set_default_tax_rate, only: :edit
before_filter :enable_updates, only: :update
private
@@ -38,6 +38,17 @@ module Spree
params[:adjustment][:included_tax] = 0
end
end
# Spree 2.0 keeps shipping fee adjustments open unless they are manually
# closed. But open adjustments cannot be edited.
# To preserve updates, like changing the amount of the shipping fee,
# we close the adjustment first.
#
# The Spree admin interface allows to open and close adjustments manually
# but we removed that functionality as it had no purpose for us.
def enable_updates
@adjustment.close
end
end
end
end

View File

@@ -349,6 +349,16 @@ feature %q{
end
end
end
scenario "editing shipping fees" do
click_link "Adjustments"
page.find('td.actions a.icon-edit').click
fill_in "Amount", with: "5"
click_button "Continue"
expect(page.find("td.amount")).to have_content "$5.00"
end
end
scenario "creating an order with distributor and order cycle" do