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
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
Build booking