Class: Comee::Core::AdditionalService

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ransackable_associations(_auth_object = nil) ⇒ Object



25
26
27
# File 'app/models/comee/core/additional_service.rb', line 25

def self.ransackable_associations(_auth_object = nil)
  %w[sales_order]
end

.ransackable_attributes(_auth_object = nil) ⇒ Object



21
22
23
# File 'app/models/comee/core/additional_service.rb', line 21

def self.ransackable_attributes(_auth_object = nil)
  %w[id name sales_order_id]
end

Instance Method Details

#calculate_total_priceObject



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

def calculate_total_price
  self.total_price = (price * quantity).round(2)
end

#update_sales_orderObject



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

def update_sales_order
  sales_order.calculate_total_price
  sales_order.calculate_vat
end