Class: Comee::Core::ReceivedItem

Inherits:
ApplicationRecord show all
Defined in:
app/models/comee/core/received_item.rb

Instance Method Summary collapse

Instance Method Details

#check_quantity_receivedObject



17
18
19
# File 'app/models/comee/core/received_item.rb', line 17

def check_quantity_received
  errors.add(:quantity_received, "can't be greater than quantity ordered") if quantity_received.to_i > quantity_ordered.to_i
end

#update_total_priceObject



12
13
14
15
# File 'app/models/comee/core/received_item.rb', line 12

def update_total_price
  self.total_price ||= 0
  self.total_price = unit_price * quantity_received
end