class ProductWaste < ActiveRecord::Base
	belongs_to :product
	belongs_to :user
	belongs_to :pointsale
	belongs_to :warehouse
	belongs_to :products_return_in

  	##--- Llevar registro de Actividad del usuario
	audited

	validates :product_id , :presence => { message: "Debe seleccionar producto." }, :on => [:create]
	validates :quantity , :presence => { message: "Debe indicar cantidad." }, :on => [:create]
	validates :reason , :presence => { message: "Debe indicar el motivo." }, :on => [:create]

	enum status: [:active, :inactive ]

	scope :activos, -> { where( "status = 0").order(" id DESC") }
end
