Module: InventoryExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/models/inventory_extensions.rb

Instance Method Summary collapse

Instance Method Details

#mesonic_price(customer_id: nil) ⇒ Object

— Instance Methods — #



12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/inventory_extensions.rb', line 12

def mesonic_price(customer_id: nil )
  customer = User.find(customer_id)
  return nil unless customer && customer.

  customer_prices = self.mesonic_prices.by_customer(customer.)
  return customer_prices.first.price if customer_prices.any?

#   HAS 20140407 Was not active in Opensteam!
#    group_prices = self.mesonic_prices.by_group_through_customer(customer.erp_account_nr)
#    return group_prices.first.price if customer_prices.any?
end