Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix quantity check inside `stock_movements` nested attributes (#12238)
Damian Kaczmarczyk025d2f7ae0b9
diff --git a/core/app/models/spree/stock_transfer.rb b/core/app/models/spree/stock_transfer.rbindex 7faeeb3ae8..deb4066f6a 100644--- a/core/app/models/spree/stock_transfer.rb+++ b/core/app/models/spree/stock_transfer.rb@@ -9,7 +9,10 @@ module Spreeendhas_many :stock_movements, as: :originator- accepts_nested_attributes_for :stock_movements, reject_if: :all_blank+ accepts_nested_attributes_for :stock_movements, reject_if: proc { |attributes|+ attributes[:quantity] = attributes[:quantity].to_i+ attributes[:quantity].blank? || attributes[:quantity].zero? || attributes[:stock_item_id].blank? || attributes[:originator_id].blank?+ }belongs_to :source_location, class_name: 'StockLocation', optional: truebelongs_to :destination_location, class_name: 'StockLocation'