Ensure order association is set correctly when adding admin adjustments

This commit is contained in:
Matt-Yorkley
2021-03-15 11:15:23 +00:00
parent 8531d82f02
commit 3219ea231d
2 changed files with 9 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ module Spree
destroy.after :reload_order
prepend_before_action :set_included_tax, only: [:create, :update]
before_action :set_order_id, only: [:create, :update]
before_action :set_default_tax_rate, only: :edit
before_action :enable_updates, only: :update
@@ -22,6 +23,10 @@ module Spree
parent.all_adjustments.eligible.find(params[:id])
end
def set_order_id
@adjustment.order_id = parent.id
end
# Choose a default tax rate to show on the edit form. The adjustment stores its included
# tax in dollars, but doesn't store the source of the tax (ie. TaxRate that generated it).
# We guess which tax rate here, choosing: