Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

### Fixed
* Revert recent proxy changes which breaks proxy usage by @andrewdicken-stripe in https://github.com/NetSweet/netsuite/pull/579
* Add record backing `sales_team_list` field on `Invoice` (#626)

### Breaking Changes

Expand Down
2 changes: 2 additions & 0 deletions lib/netsuite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ module Records
autoload :Invoice, 'netsuite/records/invoice'
autoload :InvoiceItem, 'netsuite/records/invoice_item'
autoload :InvoiceItemList, 'netsuite/records/invoice_item_list'
autoload :InvoiceSalesTeam, 'netsuite/records/invoice_sales_team'
autoload :InvoiceSalesTeamList, 'netsuite/records/invoice_sales_team_list'
autoload :ItemAvailability, 'netsuite/records/item_availability'
autoload :ItemFulfillment, 'netsuite/records/item_fulfillment'
autoload :ItemFulfillmentItem, 'netsuite/records/item_fulfillment_item'
Expand Down
3 changes: 2 additions & 1 deletion lib/netsuite/records/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Invoice
:linked_tracking_numbers, :memo, :message, :message_sel, :on_credit_hold, :opportunity,
:other_ref_num, :partners_list, :rev_rec_end_date,
:rev_rec_on_rev_commitment, :rev_rec_schedule, :rev_rec_start_date, :revenue_status, :sales_effective_date,
:sales_group, :sales_team_list, :ship_date, :ship_group_list,
:sales_group, :ship_date, :ship_group_list,
:shipping_cost, :shipping_tax_1_rate, :shipping_tax_2_rate, :source, :start_date,
:status, :sync_partner_teams, :sync_sales_teams, :tax_2_total,
:tax_total, :time_disc_amount, :time_disc_print, :time_disc_rate, :time_disc_tax_1_amt, :time_disc_taxable,
Expand All @@ -36,6 +36,7 @@ class Invoice
field :transaction_ship_address, ShipAddress
field :item_list, InvoiceItemList
field :custom_field_list, CustomFieldList
field :sales_team_list, InvoiceSalesTeamList
field :shipping_address, Address
field :billing_address, Address
field :null_field_list, NullFieldList
Expand Down
24 changes: 24 additions & 0 deletions lib/netsuite/records/invoice_sales_team.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module NetSuite
module Records
class InvoiceSalesTeam
include Support::Fields
include Support::RecordRefs
include Support::Records
include Namespaces::TranSales

fields :is_primary, :contribution

record_refs :sales_role, :employee

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

end
end
end
9 changes: 9 additions & 0 deletions lib/netsuite/records/invoice_sales_team_list.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module NetSuite
module Records
class InvoiceSalesTeamList < Support::Sublist
include Namespaces::TranSales

sublist :sales_team, NetSuite::Records::InvoiceSalesTeam
end
end
end
41 changes: 41 additions & 0 deletions spec/netsuite/records/invoice_sales_team_list_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require 'spec_helper'

describe NetSuite::Records::InvoiceSalesTeamList do
let(:list) { NetSuite::Records::InvoiceSalesTeamList.new }

it 'has an invoice_sales_team attribute' do
expect(list.sales_team).to be_kind_of(Array)
end

describe '#to_record' do
it 'can represent itself as a SOAP record' do
list.replace_all = true

record = {
'tranSales:salesTeam' => [],
'tranSales:replaceAll' => true
}
expect(list.to_record).to eql(record)
end
end

describe "#replace_all" do
it "can be changed via accessor" do
list.replace_all = false

expect(list.replace_all).to eql(false)
end

it "coerces to a boolean" do
list.replace_all = "goober"

record = {
'tranSales:salesTeam' => [],
'tranSales:replaceAll' => true
}

expect(list.to_record).to eql(record)
end
end

end
3 changes: 2 additions & 1 deletion spec/netsuite/records/invoice_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
:linked_tracking_numbers, :memo, :message, :message_sel, :on_credit_hold, :opportunity,
:other_ref_num, :partners_list, :rev_rec_end_date,
:rev_rec_on_rev_commitment, :rev_rec_schedule, :rev_rec_start_date, :revenue_status, :sales_effective_date,
:sales_group, :sales_team_list, :ship_address, :ship_date, :ship_group_list,
:sales_group, :ship_address, :ship_date, :ship_group_list,
:shipping_cost, :shipping_tax_1_rate, :shipping_tax_2_rate, :source, :start_date,
:status, :sync_partner_teams, :sync_sales_teams, :tax_2_total,
:tax_total, :time_disc_amount, :time_disc_print, :time_disc_rate, :time_disc_tax_1_amt, :time_disc_taxable,
Expand All @@ -38,6 +38,7 @@
transaction_ship_address: NetSuite::Records::ShipAddress,
item_list: NetSuite::Records::InvoiceItemList,
custom_field_list: NetSuite::Records::CustomFieldList,
sales_team_list: NetSuite::Records::InvoiceSalesTeamList,
shipping_address: NetSuite::Records::Address,
billing_address: NetSuite::Records::Address,
null_field_list: NetSuite::Records::NullFieldList,
Expand Down
Loading