Class: Cats::Core::ReceiptAuthorization
Constant Summary
Authorization::AUTHORIZED, Authorization::CONFIRMED, Authorization::STATUSES
Class Method Summary
collapse
Instance Method Summary
collapse
#confirm, #set_unit, #transactions, #validate_dispatch_status
Class Method Details
.ransackable_associations(_auth_object = nil) ⇒ Object
30
31
32
33
34
35
36
|
# File 'app/models/cats/core/receipt_authorization.rb', line 30
def self.ransackable_associations(_auth_object = nil)
%w[
receipts
lost_commodities
receipt_transactions
]
end
|
.ransackable_attributes(_auth_object = nil) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/models/cats/core/receipt_authorization.rb', line 18
def self.ransackable_attributes(_auth_object = nil)
%w[
authorized_by_id
dispatch_id
received_quantity
quantity
status
store_id
unit_id
]
end
|
Instance Method Details
#validate_quantity ⇒ Object
11
12
13
14
15
16
|
# File 'app/models/cats/core/receipt_authorization.rb', line 11
def validate_quantity
return unless dispatch && quantity && unit
authorizations = ReceiptAuthorization.where(dispatch: dispatch)
ValidationUtil.validate_quantity(self, "dispatch", authorizations, "dispatch")
end
|