Update shipping_category association in models

This commit is contained in:
Matt-Yorkley
2023-07-15 15:51:37 +01:00
parent e2caebc374
commit 57d6fa006c
2 changed files with 3 additions and 4 deletions

View File

@@ -33,7 +33,6 @@ module Spree
searchable_associations :supplier, :properties, :primary_taxon, :variants
searchable_scopes :active, :with_properties
belongs_to :shipping_category, class_name: 'Spree::ShippingCategory'
belongs_to :supplier, class_name: 'Enterprise', optional: false, touch: true
belongs_to :primary_taxon, class_name: 'Spree::Taxon', optional: false, touch: true
@@ -52,7 +51,6 @@ module Spree
through: :variants
validates :name, presence: true
validates :shipping_category, presence: true
validates :variant_unit, presence: true
validates :unit_value, presence:

View File

@@ -29,9 +29,9 @@ module Spree
belongs_to :product, -> { with_deleted }, touch: true, class_name: 'Spree::Product'
belongs_to :tax_category, class_name: 'Spree::TaxCategory'
belongs_to :shipping_category, class_name: 'Spree::ShippingCategory'
delegate_belongs_to :product, :name, :description, :shipping_category_id,
:meta_keywords, :shipping_category
delegate_belongs_to :product, :name, :description, :meta_keywords
has_many :inventory_units, inverse_of: :variant
has_many :line_items, inverse_of: :variant
@@ -63,6 +63,7 @@ module Spree
validate :check_currency
validates :price, numericality: { greater_than_or_equal_to: 0 }, presence: true
validates :shipping_category, presence: true
validates :tax_category, presence: true,
if: proc { Spree::Config[:products_require_tax_category] }