Class: Comee::Core::PurchaseRequisition
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Comee::Core::PurchaseRequisition
- Defined in:
- app/models/comee/core/purchase_requisition.rb
Class Method Summary collapse
- .ransackable_associations(_auth_object = nil) ⇒ Object
- .ransackable_attributes(_auth_object = nil) ⇒ Object
Instance Method Summary collapse
Class Method Details
.ransackable_associations(_auth_object = nil) ⇒ Object
18 19 20 |
# File 'app/models/comee/core/purchase_requisition.rb', line 18 def self.ransackable_associations(_auth_object = nil) [] end |
.ransackable_attributes(_auth_object = nil) ⇒ Object
14 15 16 |
# File 'app/models/comee/core/purchase_requisition.rb', line 14 def self.ransackable_attributes(_auth_object = nil) %w[created_at id remark requisition_date delivery_date requisition_no status purchase_status total_price updated_at] end |
Instance Method Details
#calculate_total_price ⇒ Object
22 23 24 25 |
# File 'app/models/comee/core/purchase_requisition.rb', line 22 def calculate_total_price items = PurchaseRequisitionItem.where(purchase_requisition_id: id) self.total_price = items.sum(&:total_price) end |
#generate_requisition_no ⇒ Object
27 28 29 |
# File 'app/models/comee/core/purchase_requisition.rb', line 27 def generate_requisition_no self.requisition_no = Util.generate_number("PurchaseRequisition", "requisition_no", "PR") end |