Sha256: 9ab3eece6cef1a9c842316f7500ba6ab093d2c49114ce8ece06bdf5d13990ad9
Contents?: true
Size: 594 Bytes
Versions: 14
Compression:
Stored size: 594 Bytes
Contents
module Spree class StockMovement < ActiveRecord::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
14 entries across 14 versions & 1 rubygems