Simplify orders helper

This commit is contained in:
Maikel Linke
2019-04-03 11:15:54 +11:00
parent 7035d57267
commit d31b5efac6

View File

@@ -4,16 +4,9 @@ module Admin
#
# We exclude shipping method adjustments because they are displayed in a
# separate table together with the order line items.
#
# We also exclude tax rate adjustment with zero value.
def order_adjustments_for_display(order)
order.adjustments.eligible.select do |adjustment|
type = adjustment.originator_type
is_shipping_method_adjustment = (type == 'Spree::ShippingMethod')
is_zero_tax_rate_adjustment = (type == 'Spree::TaxRate' && adjustment.amount.zero?)
!is_shipping_method_adjustment && !is_zero_tax_rate_adjustment
adjustment.originator_type != "Spree::ShippingMethod"
end
end
end