class StockCheck < ApplicationRecord
  has_many :stock_check_items

  def create(user, reason, item_list)
    self.reason = reason
    self.check_by = user.id
    self.check_start = Time.now
    self.check_end = Time.now
    save
    item_list.each do |item|
      stockItem = StockCheckItem.new
      stockItem.create(id, item)
    end
    self
  end
end
