Skip to content

Commit

Permalink
Merge pull request #13 from CloudsnapInc/cld-917-class-at-vendorcredit
Browse files Browse the repository at this point in the history
[CLD-917-vendor-credit-klass]
  • Loading branch information
reginad1 authored May 11, 2020
2 parents 16371f7 + c36ebba commit 7db5d5d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
23 changes: 20 additions & 3 deletions lib/netsuite/records/vendor_credit_expense.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,27 @@ class VendorCreditExpense

field :custom_field_list, CustomFieldList

record_refs :account, :category, :customer, :department, :item, :location, :units, :tax_code
record_refs :account, :category, :customer, :department, :item, :location, :units, :tax_code, :klass

def initialize(attributes = {})
initialize_from_attributes_hash(attributes)
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
Expand Down
23 changes: 20 additions & 3 deletions lib/netsuite/records/vendor_credit_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,27 @@ class VendorCreditItem
field :custom_field_list, CustomFieldList
field :options, CustomFieldList

record_refs :item, :units, :department, :customer, :location, :tax_code
record_refs :item, :units, :department, :customer, :location, :tax_code, :klass

def initialize(attributes = {})
initialize_from_attributes_hash(attributes)
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
Expand Down

0 comments on commit 7db5d5d

Please sign in to comment.