spree_core 4.2.0.rc2 → 4.2.0.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/spree/base_controller.rb +0 -2
- data/app/finders/spree/addresses/find.rb +1 -12
- data/app/finders/spree/base_finder.rb +14 -0
- data/app/finders/spree/countries/find.rb +11 -3
- data/app/finders/spree/credit_cards/find.rb +2 -2
- data/app/finders/spree/orders/find_current.rb +1 -1
- data/app/helpers/spree/base_helper.rb +1 -7
- data/app/mailers/spree/base_mailer.rb +4 -4
- data/app/mailers/spree/order_mailer.rb +3 -3
- data/app/mailers/spree/reimbursement_mailer.rb +1 -1
- data/app/mailers/spree/shipment_mailer.rb +1 -1
- data/app/models/concerns/spree/default_price.rb +1 -5
- data/app/models/concerns/spree/user_methods.rb +2 -2
- data/app/models/spree/ability.rb +2 -6
- data/app/models/spree/address.rb +4 -0
- data/app/models/spree/app_dependencies.rb +4 -2
- data/app/models/spree/base.rb +5 -0
- data/app/models/spree/fulfilment_changer.rb +58 -16
- data/app/models/spree/inventory_unit.rb +2 -7
- data/app/models/spree/line_item.rb +1 -6
- data/app/models/spree/order.rb +1 -0
- data/app/models/spree/payment.rb +18 -4
- data/app/models/spree/payment/processing.rb +2 -2
- data/app/models/spree/payment_method.rb +3 -3
- data/app/models/spree/price.rb +1 -6
- data/app/models/spree/product.rb +12 -2
- data/app/models/spree/promotion/rules/product.rb +2 -1
- data/app/models/spree/promotion/rules/user.rb +2 -1
- data/app/models/spree/refund.rb +2 -2
- data/app/models/spree/return_item/eligibility_validator/default.rb +0 -2
- data/app/models/spree/return_item/eligibility_validator/{r_m_a_required.rb → rma_required.rb} +0 -0
- data/app/models/spree/shipment.rb +1 -1
- data/app/models/spree/shipping_method.rb +1 -5
- data/app/models/spree/shipping_rate.rb +2 -11
- data/app/models/spree/stock/availability_validator.rb +3 -4
- data/app/models/spree/stock_item.rb +1 -5
- data/app/models/spree/store.rb +24 -0
- data/app/models/spree/store_credit.rb +1 -1
- data/app/models/spree/variant.rb +1 -8
- data/app/models/spree/zone.rb +13 -4
- data/app/services/spree/account/addresses/create.rb +6 -1
- data/app/services/spree/account/addresses/{base.rb → helper.rb} +1 -3
- data/app/services/spree/account/addresses/update.rb +6 -1
- data/app/services/spree/compare_line_items.rb +4 -2
- data/app/sorters/spree/base_sorter.rb +35 -0
- data/app/sorters/spree/orders/sort.rb +1 -37
- data/app/sorters/spree/products/sort.rb +9 -32
- data/app/validators/email_validator.rb +1 -1
- data/config/initializers/inflections.rb +3 -0
- data/config/initializers/rails61_fixes.rb +3 -0
- data/config/locales/en.yml +25 -8
- data/db/migrate/20130326175857_add_stock_location_to_rma.rb +1 -1
- data/db/migrate/20201127084048_add_default_country_kind_to_spree_zones.rb +5 -0
- data/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb +5 -0
- data/db/migrate/20210114182625_create_spree_payment_methods_stores.rb +10 -0
- data/db/migrate/20210114220232_migrate_data_payment_methods_stores.rb +15 -0
- data/db/migrate/20210117112551_remove_store_id_from_spree_payment_methods.rb +5 -0
- data/lib/spree/core/product_filters.rb +3 -3
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/i18n.rb +7 -21
- data/lib/spree/permitted_attributes.rb +2 -2
- data/lib/spree/service_module.rb +6 -2
- data/lib/spree/testing_support/capybara_config.rb +1 -1
- data/lib/spree/testing_support/factories/shipment_factory.rb +7 -9
- data/lib/spree/testing_support/factories/zone_factory.rb +16 -13
- data/lib/spree/testing_support/order_walkthrough.rb +8 -3
- data/lib/spree/testing_support/rspec_retry_config.rb +10 -0
- data/spree_core.gemspec +4 -3
- metadata +55 -21
- data/lib/spree/i18n/base.rb +0 -17
- data/lib/spree/i18n/initializer.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e1c991fe1a4f4ffcb163ad34f7db0d399c802a14b09cabae9b6db567db1adbc
|
4
|
+
data.tar.gz: 6d27129f5c12ec9b48941c3001a341d8306e219fdb702b153944645bc1044b72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4627be5137cf9b13ac72562df61b91a6ad0a95eb0119e9b9cf0c9a32b562874799ff35a0187ae8eadec622c88c0c5ee56f10cb21df79512b6524394b2f668fb1
|
7
|
+
data.tar.gz: ecaf570ab3245130d1ea2b521e0201937617e2aa0d308051d56ec17e2757549ce202fc243bb0c9b7609e379dfb7179005773656a8c7cc69632341c9751a26967
|
@@ -1,13 +1,21 @@
|
|
1
1
|
module Spree
|
2
2
|
module Countries
|
3
|
-
class Find
|
4
|
-
def initialize(scope
|
3
|
+
class Find < ::Spree::BaseFinder
|
4
|
+
def initialize(scope:, params:)
|
5
5
|
@scope = scope
|
6
6
|
|
7
7
|
@shippable = String(params[:filter][:shippable]) unless params[:filter].nil?
|
8
8
|
end
|
9
9
|
|
10
10
|
def call
|
11
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
12
|
+
Spree::Countries::Find.new.call is deprecated and will be removed in Spree 5.0.
|
13
|
+
Please use Spree::Countries::Find.new.execute instead
|
14
|
+
DEPRECATION
|
15
|
+
execute
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute
|
11
19
|
countries = by_shippability(scope)
|
12
20
|
|
13
21
|
countries
|
@@ -15,7 +23,7 @@ module Spree
|
|
15
23
|
|
16
24
|
private
|
17
25
|
|
18
|
-
attr_reader :shippable
|
26
|
+
attr_reader :shippable
|
19
27
|
|
20
28
|
def shippable?
|
21
29
|
shippable.present?
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Spree
|
2
2
|
module CreditCards
|
3
|
-
class Find
|
4
|
-
def execute
|
3
|
+
class Find < ::Spree::BaseFinder
|
4
|
+
def execute
|
5
5
|
return scope.default.take if params[:id].eql?('default')
|
6
6
|
return scope.where(payment_method_id: params[:filter]['payment_method_id']) if params[:filter].present?
|
7
7
|
|
@@ -1,13 +1,7 @@
|
|
1
1
|
module Spree
|
2
2
|
module BaseHelper
|
3
3
|
def available_countries
|
4
|
-
|
5
|
-
|
6
|
-
countries = if checkout_zone && checkout_zone.kind == 'country'
|
7
|
-
checkout_zone.country_list
|
8
|
-
else
|
9
|
-
Spree::Country.all
|
10
|
-
end
|
4
|
+
countries = current_store.countries_available_for_checkout
|
11
5
|
|
12
6
|
countries.collect do |country|
|
13
7
|
country.name = Spree.t(country.iso, scope: 'country_names', default: country.name)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Spree
|
2
2
|
class BaseMailer < ActionMailer::Base
|
3
|
-
|
3
|
+
helper Spree::MailHelper
|
4
4
|
|
5
5
|
def current_store
|
6
6
|
@current_store ||= Spree::Store.current
|
@@ -23,7 +23,7 @@ module Spree
|
|
23
23
|
helper_method :frontend_available?
|
24
24
|
|
25
25
|
def mail(headers = {}, &block)
|
26
|
-
ensure_default_action_mailer_url_host
|
26
|
+
ensure_default_action_mailer_url_host(headers[:store_url])
|
27
27
|
set_email_locale
|
28
28
|
super if Spree::Config[:send_core_emails]
|
29
29
|
end
|
@@ -33,9 +33,9 @@ module Spree
|
|
33
33
|
# this ensures that ActionMailer::Base.default_url_options[:host] is always set
|
34
34
|
# this is only a fail-safe solution if developer didn't set this in environment files
|
35
35
|
# http://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views
|
36
|
-
def ensure_default_action_mailer_url_host
|
36
|
+
def ensure_default_action_mailer_url_host(store_url = nil)
|
37
37
|
ActionMailer::Base.default_url_options ||= {}
|
38
|
-
ActionMailer::Base.default_url_options[:host] ||= current_store.url
|
38
|
+
ActionMailer::Base.default_url_options[:host] ||= store_url || current_store.url
|
39
39
|
end
|
40
40
|
|
41
41
|
def set_email_locale
|
@@ -5,14 +5,14 @@ module Spree
|
|
5
5
|
current_store = @order.store
|
6
6
|
subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '')
|
7
7
|
subject += "#{current_store.name} #{Spree.t('order_mailer.confirm_email.subject')} ##{@order.number}"
|
8
|
-
mail(to: @order.email, from: from_address, subject: subject)
|
8
|
+
mail(to: @order.email, from: from_address, subject: subject, store_url: current_store.url)
|
9
9
|
end
|
10
10
|
|
11
11
|
def store_owner_notification_email(order)
|
12
12
|
@order = order.respond_to?(:id) ? order : Spree::Order.find(order)
|
13
13
|
current_store = @order.store
|
14
14
|
subject = Spree.t('order_mailer.store_owner_notification_email.subject', store_name: current_store.name)
|
15
|
-
mail(to: current_store.new_order_notifications_email, from: from_address, subject: subject)
|
15
|
+
mail(to: current_store.new_order_notifications_email, from: from_address, subject: subject, store_url: current_store.url)
|
16
16
|
end
|
17
17
|
|
18
18
|
def cancel_email(order, resend = false)
|
@@ -20,7 +20,7 @@ module Spree
|
|
20
20
|
current_store = @order.store
|
21
21
|
subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '')
|
22
22
|
subject += "#{current_store.name} #{Spree.t('order_mailer.cancel_email.subject')} ##{@order.number}"
|
23
|
-
mail(to: @order.email, from: from_address, subject: subject)
|
23
|
+
mail(to: @order.email, from: from_address, subject: subject, store_url: current_store.url)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -6,7 +6,7 @@ module Spree
|
|
6
6
|
current_store = @reimbursement.store || Spree::Store.current
|
7
7
|
subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '')
|
8
8
|
subject += "#{current_store.name} #{Spree.t('reimbursement_mailer.reimbursement_email.subject')} ##{@order.number}"
|
9
|
-
mail(to: @order.email, from: current_store.mail_from_address, subject: subject)
|
9
|
+
mail(to: @order.email, from: current_store.mail_from_address, subject: subject, store_url: current_store.url)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -6,7 +6,7 @@ module Spree
|
|
6
6
|
current_store = @shipment.store
|
7
7
|
subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '')
|
8
8
|
subject += "#{current_store.name} #{Spree.t('shipment_mailer.shipped_email.subject')} ##{@order.number}"
|
9
|
-
mail(to: @order.email, from: from_address, subject: subject)
|
9
|
+
mail(to: @order.email, from: from_address, subject: subject, store_url: current_store.url)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -4,7 +4,7 @@ module Spree
|
|
4
4
|
|
5
5
|
included do
|
6
6
|
has_one :default_price,
|
7
|
-
-> { where
|
7
|
+
-> { with_deleted.where(currency: Spree::Config[:currency]) },
|
8
8
|
class_name: 'Spree::Price',
|
9
9
|
dependent: :destroy
|
10
10
|
|
@@ -14,10 +14,6 @@ module Spree
|
|
14
14
|
|
15
15
|
after_save :save_default_price
|
16
16
|
|
17
|
-
def default_price
|
18
|
-
Spree::Price.unscoped { super }
|
19
|
-
end
|
20
|
-
|
21
17
|
def has_default_price?
|
22
18
|
!default_price.nil?
|
23
19
|
end
|
@@ -31,7 +31,7 @@ module Spree
|
|
31
31
|
self.whitelisted_ransackable_attributes = %w[id email]
|
32
32
|
|
33
33
|
def self.with_email(query)
|
34
|
-
where(
|
34
|
+
where("#{table_name}.email LIKE ?", "%#{query}%")
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.with_address(query, address = :ship_address)
|
@@ -42,7 +42,7 @@ module Spree
|
|
42
42
|
|
43
43
|
def self.with_email_or_address(email, address)
|
44
44
|
left_outer_joins(:addresses).
|
45
|
-
where("#{Spree::Address.table_name}.firstname LIKE ? or #{Spree::Address.table_name}.lastname LIKE ? or email LIKE ?",
|
45
|
+
where("#{Spree::Address.table_name}.firstname LIKE ? or #{Spree::Address.table_name}.lastname LIKE ? or #{table_name}.email LIKE ?",
|
46
46
|
"%#{address}%", "%#{address}%", "%#{email}%")
|
47
47
|
end
|
48
48
|
end
|
data/app/models/spree/ability.rb
CHANGED
@@ -42,12 +42,7 @@ module Spree
|
|
42
42
|
can :update, Order do |order, token|
|
43
43
|
!order.completed? && (order.user == user || order.token && token == order.token)
|
44
44
|
end
|
45
|
-
can :manage,
|
46
|
-
address.user == user
|
47
|
-
end
|
48
|
-
can :create, Spree::Address do |_address|
|
49
|
-
user.id.present?
|
50
|
-
end
|
45
|
+
can :manage, Address, user_id: user.id
|
51
46
|
can :read, CreditCard, user_id: user.id
|
52
47
|
can :read, Product
|
53
48
|
can :read, ProductProperty
|
@@ -55,6 +50,7 @@ module Spree
|
|
55
50
|
can :create, Spree.user_class
|
56
51
|
can [:show, :update, :destroy], Spree.user_class, id: user.id
|
57
52
|
can :read, State
|
53
|
+
can :read, Store
|
58
54
|
can :read, Taxon
|
59
55
|
can :read, Taxonomy
|
60
56
|
can :read, Variant
|
data/app/models/spree/address.rb
CHANGED
@@ -2,6 +2,10 @@ module Spree
|
|
2
2
|
class Address < Spree::Base
|
3
3
|
require 'twitter_cldr'
|
4
4
|
|
5
|
+
if Rails::VERSION::STRING >= '6.1'
|
6
|
+
serialize :preferences, Hash, default: {}
|
7
|
+
end
|
8
|
+
|
5
9
|
NO_ZIPCODE_ISO_CODES ||= [
|
6
10
|
'AO', 'AG', 'AW', 'BS', 'BZ', 'BJ', 'BM', 'BO', 'BW', 'BF', 'BI', 'CM', 'CF', 'KM', 'CG',
|
7
11
|
'CD', 'CK', 'CUW', 'CI', 'DJ', 'DM', 'GQ', 'ER', 'FJ', 'TF', 'GAB', 'GM', 'GH', 'GD', 'GN',
|
@@ -12,7 +12,8 @@ module Spree
|
|
12
12
|
:coupon_handler, :country_finder, :current_order_finder, :credit_card_finder,
|
13
13
|
:completed_order_finder, :order_sorter, :cart_compare_line_items_service, :collection_paginator, :products_sorter,
|
14
14
|
:products_finder, :taxon_finder, :line_item_by_variant_finder, :cart_estimate_shipping_rates_service,
|
15
|
-
:account_create_address_service, :account_update_address_service, :address_finder
|
15
|
+
:account_create_address_service, :account_update_address_service, :address_finder,
|
16
|
+
:collection_sorter
|
16
17
|
].freeze
|
17
18
|
|
18
19
|
attr_accessor *INJECTION_POINTS
|
@@ -51,7 +52,8 @@ module Spree
|
|
51
52
|
@checkout_get_shipping_rates_service = 'Spree::Checkout::GetShippingRates'
|
52
53
|
|
53
54
|
# sorter
|
54
|
-
@
|
55
|
+
@collection_sorter = 'Spree::BaseSorter'
|
56
|
+
@order_sorter = 'Spree::BaseSorter'
|
55
57
|
@products_sorter = 'Spree::Products::Sort'
|
56
58
|
|
57
59
|
# paginator
|
data/app/models/spree/base.rb
CHANGED
@@ -36,7 +36,7 @@ module Spree
|
|
36
36
|
private
|
37
37
|
|
38
38
|
attr_reader :variant, :quantity, :current_stock_location, :desired_stock_location,
|
39
|
-
|
39
|
+
:current_shipment, :desired_shipment, :available_quantity
|
40
40
|
|
41
41
|
def handle_stock
|
42
42
|
ActiveRecord::Base.transaction do
|
@@ -45,13 +45,64 @@ module Spree
|
|
45
45
|
desired_stock_location.unstock(variant, unstock_quantity, desired_shipment)
|
46
46
|
end
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
move_inventory_units_between_shipments
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def move_inventory_units_between_shipments
|
53
|
+
update_desired_shipment_inventory_units
|
54
|
+
update_current_shipment_inventory_units
|
55
|
+
end
|
56
|
+
|
57
|
+
def current_shipment_units
|
58
|
+
@current_shipment_units ||= current_shipment.inventory_units.on_hand_or_backordered.where(variant_id: variant.id)
|
59
|
+
end
|
60
|
+
|
61
|
+
def update_desired_shipment_inventory_units
|
62
|
+
on_hand_unit = get_desired_shipment_inventory_unit(:on_hand)
|
63
|
+
on_hand_unit.update(quantity: on_hand_unit.quantity + new_on_hand_quantity)
|
64
|
+
|
65
|
+
new_backorder_quantity = current_on_hand_quantity - new_on_hand_quantity
|
66
|
+
if new_backorder_quantity > 0
|
67
|
+
backordered_unit = get_desired_shipment_inventory_unit(:backordered)
|
68
|
+
backordered_unit.update(quantity: backordered_unit.quantity + new_backorder_quantity)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def update_current_shipment_inventory_units
|
73
|
+
reduced_quantity = current_on_hand_quantity
|
74
|
+
|
75
|
+
# Reduce quantities from all backordered units first in case there is more than one.
|
76
|
+
backorder_units = current_shipment_units.backordered
|
77
|
+
reduced_quantity = reduce_units_quantities(reduced_quantity, backorder_units) if backorder_units.any?
|
78
|
+
|
79
|
+
# Reduce quantities from all on_hand units in case there is more than one.
|
80
|
+
if reduced_quantity > 0
|
81
|
+
on_hand_units = current_shipment_units.on_hand
|
82
|
+
reduce_units_quantities(reduced_quantity, on_hand_units) if on_hand_units.any?
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def reduce_units_quantities(reduced_quantity, units)
|
87
|
+
units.each do |unit|
|
88
|
+
unit.quantity > reduced_quantity ? unit.update(quantity: unit.quantity - reduced_quantity) : unit.destroy!
|
89
|
+
reduced_quantity -= unit.quantity
|
90
|
+
end
|
91
|
+
reduced_quantity
|
92
|
+
end
|
93
|
+
|
94
|
+
def get_desired_shipment_inventory_unit(state)
|
95
|
+
desired_shipment.inventory_units.find_or_create_by(state: state) do |unit|
|
96
|
+
current_shipment_unit = current_shipment_units.first
|
97
|
+
unit.variant_id = current_shipment_unit.variant_id
|
98
|
+
unit.order_id = current_shipment_unit.order_id
|
99
|
+
unit.line_item_id = current_shipment_unit.line_item_id
|
100
|
+
unit.quantity = 0
|
50
101
|
end
|
51
102
|
end
|
52
103
|
|
53
104
|
def after_process_shipments
|
54
|
-
if current_shipment.inventory_units.
|
105
|
+
if current_shipment.inventory_units.sum(:quantity).zero?
|
55
106
|
current_shipment.destroy!
|
56
107
|
else
|
57
108
|
current_shipment.refresh_rates
|
@@ -64,7 +115,7 @@ module Spree
|
|
64
115
|
end
|
65
116
|
|
66
117
|
def new_on_hand_quantity
|
67
|
-
[available_quantity,
|
118
|
+
[available_quantity, current_on_hand_quantity].min
|
68
119
|
end
|
69
120
|
|
70
121
|
def unstock_quantity
|
@@ -72,16 +123,7 @@ module Spree
|
|
72
123
|
end
|
73
124
|
|
74
125
|
def current_on_hand_quantity
|
75
|
-
[current_shipment.inventory_units.on_hand_or_backordered.
|
76
|
-
end
|
77
|
-
|
78
|
-
def update_current_shipment_inventory_units(quantity, state)
|
79
|
-
current_shipment.
|
80
|
-
inventory_units.
|
81
|
-
where(variant: variant).
|
82
|
-
order(state: :asc).
|
83
|
-
limit(quantity).
|
84
|
-
update_all(shipment_id: desired_shipment.id, state: state)
|
126
|
+
[current_shipment.inventory_units.on_hand_or_backordered.sum(:quantity), quantity].min
|
85
127
|
end
|
86
128
|
|
87
129
|
def reload_shipment_inventory_units
|
@@ -105,7 +147,7 @@ module Spree
|
|
105
147
|
def enough_stock_at_desired_location
|
106
148
|
return if Spree::Stock::Quantifier.new(variant, desired_stock_location).can_supply?(quantity)
|
107
149
|
|
108
|
-
errors.add(:desired_shipment, :
|
150
|
+
errors.add(:desired_shipment, :has_not_enough_stock_at_desired_location)
|
109
151
|
end
|
110
152
|
|
111
153
|
def desired_shipment_different_from_current
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Spree
|
2
2
|
class InventoryUnit < Spree::Base
|
3
3
|
with_options inverse_of: :inventory_units do
|
4
|
-
belongs_to :variant, class_name: 'Spree::Variant'
|
4
|
+
belongs_to :variant, -> { with_deleted }, class_name: 'Spree::Variant'
|
5
5
|
belongs_to :order, class_name: 'Spree::Order'
|
6
6
|
belongs_to :shipment, class_name: 'Spree::Shipment', touch: true, optional: true
|
7
|
-
has_many :return_items
|
7
|
+
has_many :return_items, inverse_of: :inventory_unit
|
8
8
|
has_many :return_authorizations, class_name: 'Spree::ReturnAuthorization', through: :return_items
|
9
9
|
belongs_to :line_item, class_name: 'Spree::LineItem'
|
10
10
|
end
|
@@ -84,11 +84,6 @@ module Spree
|
|
84
84
|
split_inventory!(1)
|
85
85
|
end
|
86
86
|
|
87
|
-
# Remove variant default_scope `deleted_at: nil`
|
88
|
-
def variant
|
89
|
-
Spree::Variant.unscoped { super }
|
90
|
-
end
|
91
|
-
|
92
87
|
def current_or_new_return_item
|
93
88
|
Spree::ReturnItem.from_inventory_unit(self)
|
94
89
|
end
|
@@ -4,7 +4,7 @@ module Spree
|
|
4
4
|
|
5
5
|
with_options inverse_of: :line_items do
|
6
6
|
belongs_to :order, class_name: 'Spree::Order', touch: true
|
7
|
-
belongs_to :variant, class_name: 'Spree::Variant'
|
7
|
+
belongs_to :variant, -> { with_deleted }, class_name: 'Spree::Variant'
|
8
8
|
end
|
9
9
|
belongs_to :tax_category, class_name: 'Spree::TaxCategory'
|
10
10
|
|
@@ -120,11 +120,6 @@ module Spree
|
|
120
120
|
assign_attributes opts
|
121
121
|
end
|
122
122
|
|
123
|
-
# Remove variant default_scope `deleted_at: nil`
|
124
|
-
def variant
|
125
|
-
Spree::Variant.unscoped { super }
|
126
|
-
end
|
127
|
-
|
128
123
|
private
|
129
124
|
|
130
125
|
def ensure_valid_quantity
|