diff --git a/app/models/spree/order.rb b/app/models/spree/order.rb index 4a5ef3bc81..20f1b3225c 100644 --- a/app/models/spree/order.rb +++ b/app/models/spree/order.rb @@ -62,6 +62,9 @@ module Spree has_many :line_item_adjustments, through: :line_items, source: :adjustments has_many :shipment_adjustments, through: :shipments, source: :adjustments has_many :all_adjustments, class_name: 'Spree::Adjustment', dependent: :destroy + has_many :vouchers, -> { where(originator_type: 'Voucher') }, + class_name: 'Spree::Adjustment', + dependent: :destroy belongs_to :order_cycle belongs_to :distributor, class_name: 'Enterprise' @@ -618,10 +621,6 @@ module Spree end end - def vouchers - adjustments.where(originator_type: 'Voucher') - end - private def fee_handler