Fix problem in order and adjustment model specs by fixing the order.adjustment association

This fix was taken from spree 2.1  here 3fa44165c7
This commit is contained in:
luisramos0
2018-10-11 17:06:10 +01:00
parent 2ccbb87adc
commit 91f52d80c8

View File

@@ -17,6 +17,14 @@ Spree::Order.class_eval do
has_one :proxy_order
has_one :subscription, through: :proxy_order
# This removes "inverse_of: source" which breaks shipment adjustment calculations
# This change is done in Spree 2.1 (see https://github.com/spree/spree/commit/3fa44165c7825f79a2fa4eb79b99dc29944c5d55)
# When OFN gets to Spree 2.1, this can be removed
has_many :adjustments,
as: :adjustable,
dependent: :destroy,
order: "#{Spree::Adjustment.table_name}.created_at ASC"
validates :customer, presence: true, if: :require_customer?
validate :products_available_from_new_distribution, :if => lambda { distributor_id_changed? || order_cycle_id_changed? }
validate :disallow_guest_order