Sha256: e0d4c2d31bd5a2f4e035c1ff975036d24905e45cdd4111057f5d06f266c9e33e
Contents?: true
Size: 587 Bytes
Versions: 33
Compression:
Stored size: 587 Bytes
Contents
module Spree class StockMovement < Spree::Base belongs_to :stock_item, class_name: 'Spree::StockItem', inverse_of: :stock_movements belongs_to :originator, polymorphic: true after_create :update_stock_item_quantity validates :stock_item, presence: true validates :quantity, presence: true scope :recent, -> { order('created_at DESC') } def readonly? !new_record? end private def update_stock_item_quantity return unless self.stock_item.should_track_inventory? stock_item.adjust_count_on_hand quantity end end end
Version data entries
33 entries across 33 versions & 2 rubygems