Class: Cats::Core::Receipt
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Cats::Core::Receipt
- Defined in:
- app/models/cats/core/receipt.rb
Instance Method Summary collapse
Instance Method Details
#set_unit ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/models/cats/core/receipt.rb', line 17 def set_unit return if unit return unless self.unit = .unit end |
#validate_quantity ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/models/cats/core/receipt.rb', line 25 def validate_quantity return unless quantity && unit && receipts = Receipt.where(receipt_authorization: ) losses = LostCommodity.where(receipt_authorization: ) ValidationUtil.validate_quantity(self, "receipt_authorization", receipts + losses, "authorized") end |