From 7d3288ca53dbf599ffcc4e5662c91328ba8a9efa Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Fri, 19 Feb 2021 16:28:30 +0000 Subject: [PATCH] Remove #to_package calls on shipment calculations --- lib/spree/core/calculated_adjustments.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/spree/core/calculated_adjustments.rb b/lib/spree/core/calculated_adjustments.rb index f773567647..ab220f365a 100644 --- a/lib/spree/core/calculated_adjustments.rb +++ b/lib/spree/core/calculated_adjustments.rb @@ -27,18 +27,12 @@ module Spree # calculator as applied to the given calculable (Order, LineItems[], Shipment, etc.) # By default the adjustment will not be considered mandatory def create_adjustment(label, target, calculable, mandatory = false, state = "closed") - # Adjustment calculations done on Spree::Shipment objects MUST - # be done on their to_package'd variants instead - # It's only the package that contains the correct information. - # See https://github.com/spree/spree_active_shipping/pull/96 et. al - old_calculable = calculable - calculable = calculable.to_package if calculable.is_a?(Spree::Shipment) amount = compute_amount(calculable) return if amount.zero? && !mandatory adjustment_attributes = { amount: amount, - source: old_calculable, + source: calculable, originator: self, order: order_object_for(target), label: label,