Module: HasAccounts::Model

Extended by:
ActiveSupport::Concern
Defined in:
lib/has_accounts/model.rb

Instance Method Summary collapse

Instance Method Details

#balance(value_date = nil, direct_account = nil) ⇒ Object


56
57
58
# File 'lib/has_accounts/model.rb', line 56

def balance(value_date = nil,  = nil)
  bookings.direct_balance(value_date, )
end

#build_booking(params = {}, template_code = nil) ⇒ Object

Build booking


41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/has_accounts/model.rb', line 41

def build_booking(params = {}, template_code = nil)
  template_code ||= self.class.to_s.underscore + ':invoice'
  booking_template = BookingTemplate.find_by_code(template_code)

  # Prepare booking parameters
  booking_params = { reference: self }
  booking_params.merge!(params)

  # Build and assign booking
  booking = booking_template.build_booking(booking_params)
  bookings << booking

  booking
end

#direct_accountObject

Delegate to class


36
37
38
# File 'lib/has_accounts/model.rb', line 36

def 
  self.class.
end