Sha256: 9096f485fa76d16efb4cc4e7a797fd981374d0d6688d97b57bb95c34789f7a18

Contents?: true

Size: 1.24 KB

Versions: 48

Compression:

Stored size: 1.24 KB

Contents

module NetSuite
  module Records
    class OpportunityItem
      include Support::Fields
      include Support::RecordRefs
      include Support::Records
      include Namespaces::TranSales

      fields :alt_sales_amt, :amount, :cost_estimate, :cost_estimate_type,
        :description, :expected_ship_date, :from_job, :gross_amt, :is_estimate,
        :is_taxable, :line, :quantity, :quantity_available, :quantity_on_hand,
        :rate, :rev_rec_term_in_months,
        :tax1_amt, :tax_rate1, :tax_rate2

      field :custom_field_list, CustomFieldList

      record_refs :department, :item, :job, :klass, :location, :price, :tax_code, :units

      def initialize(attributes_or_record = {})
        case attributes_or_record
        when Hash
          initialize_from_attributes_hash(attributes_or_record)
        when self.class
          initialize_from_record(attributes_or_record)
        end
      end

      def initialize_from_record(record)
        self.attributes = record.send(:attributes)
      end

      def to_record
        rec = super
        if rec["#{record_namespace}:customFieldList"]
          rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
        end
        rec
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
netsuite-0.5.6 lib/netsuite/records/opportunity_item.rb
netsuite-0.5.5 lib/netsuite/records/opportunity_item.rb
netsuite-0.5.4 lib/netsuite/records/opportunity_item.rb
netsuite-0.5.3 lib/netsuite/records/opportunity_item.rb
netsuite-0.5.2 lib/netsuite/records/opportunity_item.rb
netsuite-0.5.1 lib/netsuite/records/opportunity_item.rb
netsuite-0.5.0 lib/netsuite/records/opportunity_item.rb
netsuite-0.4.9 lib/netsuite/records/opportunity_item.rb