mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge pull request #7330 from Matt-Yorkley/adjustments-deleted-originator
Update unscoping of deleted_at on Adjustment originator association
This commit is contained in:
@@ -38,7 +38,7 @@ module Spree
|
||||
|
||||
belongs_to :adjustable, polymorphic: true
|
||||
belongs_to :source, polymorphic: true
|
||||
belongs_to :originator, polymorphic: true
|
||||
belongs_to :originator, -> { with_deleted }, polymorphic: true
|
||||
belongs_to :order, class_name: "Spree::Order"
|
||||
|
||||
belongs_to :tax_rate, -> { where spree_adjustments: { originator_type: 'Spree::TaxRate' } },
|
||||
@@ -139,13 +139,6 @@ module Spree
|
||||
included_tax.positive?
|
||||
end
|
||||
|
||||
# Allow accessing soft-deleted originator objects
|
||||
def originator
|
||||
return if originator_type.blank?
|
||||
|
||||
originator_type.constantize.unscoped { super }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_adjustable_adjustment_total
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
module Spree
|
||||
class ReturnAuthorization < ActiveRecord::Base
|
||||
acts_as_paranoid
|
||||
|
||||
belongs_to :order, class_name: 'Spree::Order', inverse_of: :return_authorizations
|
||||
|
||||
has_many :inventory_units, inverse_of: :return_authorization
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddDeletedAtToReturnAuthorizations < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :spree_return_authorizations, :deleted_at, :datetime
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20210329123820) do
|
||||
ActiveRecord::Schema.define(version: 20210407170804) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -754,6 +754,7 @@ ActiveRecord::Schema.define(version: 20210329123820) do
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "stock_location_id"
|
||||
t.datetime "deleted_at"
|
||||
end
|
||||
|
||||
create_table "spree_roles", force: :cascade do |t|
|
||||
|
||||
Reference in New Issue
Block a user