netsuite 0.8.2 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/Gemfile +7 -2
  5. data/README.md +107 -32
  6. data/circle.yml +33 -13
  7. data/lib/netsuite.rb +36 -19
  8. data/lib/netsuite/actions/login.rb +20 -1
  9. data/lib/netsuite/actions/search.rb +1 -6
  10. data/lib/netsuite/actions/update.rb +6 -2
  11. data/lib/netsuite/actions/update_list.rb +109 -0
  12. data/lib/netsuite/actions/upsert.rb +2 -0
  13. data/lib/netsuite/configuration.rb +21 -4
  14. data/lib/netsuite/errors.rb +1 -0
  15. data/lib/netsuite/records/assembly_build.rb +4 -1
  16. data/lib/netsuite/records/assembly_item.rb +1 -0
  17. data/lib/netsuite/records/assembly_unbuild.rb +3 -0
  18. data/lib/netsuite/records/bin_number.rb +18 -0
  19. data/lib/netsuite/records/bin_number_list.rb +1 -20
  20. data/lib/netsuite/records/bin_transfer.rb +38 -0
  21. data/lib/netsuite/records/bin_transfer_inventory.rb +20 -0
  22. data/lib/netsuite/records/bin_transfer_inventory_list.rb +10 -0
  23. data/lib/netsuite/records/cash_refund_item.rb +1 -1
  24. data/lib/netsuite/records/classification.rb +5 -2
  25. data/lib/netsuite/records/custom_field_list.rb +10 -2
  26. data/lib/netsuite/records/custom_record.rb +3 -3
  27. data/lib/netsuite/records/custom_record_ref.rb +1 -0
  28. data/lib/netsuite/records/customer.rb +5 -4
  29. data/lib/netsuite/records/customer_credit_cards.rb +36 -0
  30. data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
  31. data/lib/netsuite/records/customer_deposit.rb +5 -2
  32. data/lib/netsuite/records/customer_payment.rb +1 -0
  33. data/lib/netsuite/records/customer_sales_team.rb +24 -0
  34. data/lib/netsuite/records/customer_sales_team_list.rb +9 -0
  35. data/lib/netsuite/records/customer_status.rb +29 -0
  36. data/lib/netsuite/records/customer_subscription.rb +18 -0
  37. data/lib/netsuite/records/customer_subscriptions_list.rb +10 -0
  38. data/lib/netsuite/records/employee.rb +1 -1
  39. data/lib/netsuite/records/entity_custom_field.rb +53 -0
  40. data/lib/netsuite/records/estimate.rb +42 -0
  41. data/lib/netsuite/records/estimate_item.rb +40 -0
  42. data/lib/netsuite/records/estimate_item_list.rb +11 -0
  43. data/lib/netsuite/records/inbound_shipment.rb +33 -0
  44. data/lib/netsuite/records/inbound_shipment_item.rb +39 -0
  45. data/lib/netsuite/records/inbound_shipment_item_list.rb +11 -0
  46. data/lib/netsuite/records/inter_company_journal_entry.rb +48 -0
  47. data/lib/netsuite/records/inter_company_journal_entry_line.rb +28 -0
  48. data/lib/netsuite/records/inter_company_journal_entry_line_list.rb +14 -0
  49. data/lib/netsuite/records/inventory_item.rb +1 -1
  50. data/lib/netsuite/records/invoice.rb +1 -1
  51. data/lib/netsuite/records/item_fulfillment.rb +1 -1
  52. data/lib/netsuite/records/lot_numbered_inventory_item.rb +116 -0
  53. data/lib/netsuite/records/matrix_option_list.rb +12 -4
  54. data/lib/netsuite/records/message.rb +30 -0
  55. data/lib/netsuite/records/non_inventory_resale_item.rb +3 -2
  56. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  57. data/lib/netsuite/records/other_charge_sale_item.rb +2 -2
  58. data/lib/netsuite/records/partner.rb +1 -1
  59. data/lib/netsuite/records/price.rb +17 -0
  60. data/lib/netsuite/records/price_level.rb +26 -0
  61. data/lib/netsuite/records/price_list.rb +9 -0
  62. data/lib/netsuite/records/pricing.rb +20 -0
  63. data/lib/netsuite/records/pricing_matrix.rb +2 -2
  64. data/lib/netsuite/records/promotions.rb +26 -0
  65. data/lib/netsuite/records/promotions_list.rb +9 -0
  66. data/lib/netsuite/records/return_authorization_item.rb +1 -1
  67. data/lib/netsuite/records/sales_order.rb +1 -0
  68. data/lib/netsuite/records/sales_order_item.rb +12 -5
  69. data/lib/netsuite/records/sales_role.rb +26 -0
  70. data/lib/netsuite/records/sales_tax_item.rb +3 -1
  71. data/lib/netsuite/records/serialized_assembly_item.rb +239 -0
  72. data/lib/netsuite/records/service_resale_item.rb +1 -1
  73. data/lib/netsuite/records/service_sale_item.rb +1 -1
  74. data/lib/netsuite/records/support_case.rb +1 -1
  75. data/lib/netsuite/records/support_case_type.rb +26 -0
  76. data/lib/netsuite/records/tax_group.rb +2 -2
  77. data/lib/netsuite/records/transaction_body_custom_field.rb +61 -0
  78. data/lib/netsuite/records/transaction_column_custom_field.rb +59 -0
  79. data/lib/netsuite/records/vendor_credit.rb +2 -0
  80. data/lib/netsuite/records/work_order.rb +8 -0
  81. data/lib/netsuite/support/actions.rb +2 -0
  82. data/lib/netsuite/support/country.rb +27 -15
  83. data/lib/netsuite/support/search_result.rb +20 -5
  84. data/lib/netsuite/utilities.rb +83 -21
  85. data/lib/netsuite/version.rb +1 -1
  86. data/netsuite.gemspec +4 -3
  87. data/spec/netsuite/actions/login_spec.rb +23 -0
  88. data/spec/netsuite/actions/update_list_spec.rb +107 -0
  89. data/spec/netsuite/actions/update_spec.rb +42 -0
  90. data/spec/netsuite/configuration_spec.rb +79 -6
  91. data/spec/netsuite/records/address_spec.rb +10 -0
  92. data/spec/netsuite/records/basic_record_spec.rb +11 -1
  93. data/spec/netsuite/records/bin_number_spec.rb +23 -0
  94. data/spec/netsuite/records/classification_spec.rb +10 -1
  95. data/spec/netsuite/records/custom_field_list_spec.rb +39 -4
  96. data/spec/netsuite/records/custom_record_spec.rb +1 -1
  97. data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
  98. data/spec/netsuite/records/customer_sales_team_list_spec.rb +41 -0
  99. data/spec/netsuite/records/customer_spec.rb +44 -2
  100. data/spec/netsuite/records/customer_subscription_spec.rb +41 -0
  101. data/spec/netsuite/records/customer_subscriptions_list_spec.rb +19 -0
  102. data/spec/netsuite/records/employee_spec.rb +2 -2
  103. data/spec/netsuite/records/entity_custom_field_spec.rb +34 -0
  104. data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
  105. data/spec/netsuite/records/estimate_item_spec.rb +40 -0
  106. data/spec/netsuite/records/estimate_spec.rb +216 -0
  107. data/spec/netsuite/records/inter_company_journal_entry_line_list_spec.rb +26 -0
  108. data/spec/netsuite/records/inter_company_journal_entry_line_spec.rb +60 -0
  109. data/spec/netsuite/records/inter_company_journal_entry_spec.rb +156 -0
  110. data/spec/netsuite/records/inventory_item_spec.rb +57 -0
  111. data/spec/netsuite/records/matrix_option_list_spec.rb +15 -5
  112. data/spec/netsuite/records/message_spec.rb +49 -0
  113. data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
  114. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +1 -1
  115. data/spec/netsuite/records/partner_spec.rb +141 -0
  116. data/spec/netsuite/records/price_level_spec.rb +16 -0
  117. data/spec/netsuite/records/pricing_matrix_spec.rb +15 -13
  118. data/spec/netsuite/records/return_authorization_item_spec.rb +1 -1
  119. data/spec/netsuite/records/sales_order_item_spec.rb +11 -5
  120. data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
  121. data/spec/netsuite/records/support_case_type_spec.rb +22 -0
  122. data/spec/netsuite/records/transaction_body_custom_field_spec.rb +32 -0
  123. data/spec/netsuite/records/transaction_column_custom_field_spec.rb +32 -0
  124. data/spec/netsuite/records/vendor_credit_spec.rb +29 -0
  125. data/spec/netsuite/support/search_result_spec.rb +24 -0
  126. data/spec/netsuite/utilities_spec.rb +44 -6
  127. data/spec/spec_helper.rb +5 -4
  128. data/spec/support/fixtures/update_list/update_list_items.xml +22 -0
  129. data/spec/support/fixtures/update_list/update_list_one_item.xml +18 -0
  130. data/spec/support/fixtures/update_list/update_list_with_errors.xml +32 -0
  131. metadata +101 -8
@@ -13,7 +13,9 @@ module NetSuite
13
13
 
14
14
  @custom_fields_assoc = Hash.new
15
15
  custom_fields.each do |custom_field|
16
- # not all custom fields have an id; https://github.com/NetSweet/netsuite/issues/182
16
+ # not all custom fields have an id
17
+ # https://github.com/NetSweet/netsuite/issues/182
18
+
17
19
  if reference_id = custom_field.send(reference_id_type)
18
20
  @custom_fields_assoc[reference_id.to_sym] = custom_field
19
21
  end
@@ -96,6 +98,7 @@ module NetSuite
96
98
  end
97
99
 
98
100
  private
101
+
99
102
  def reference_id_type
100
103
  @reference_id_type ||= Configuration.api_version >= '2013_2' ? :script_id : :internal_id
101
104
  end
@@ -105,9 +108,14 @@ module NetSuite
105
108
  custom_fields << custom_field_data
106
109
  else
107
110
  attrs = custom_field_data.clone
111
+ type = (custom_field_data[:"@xsi:type"] || custom_field_data[:type])
108
112
 
109
- if (custom_field_data[:"@xsi:type"] || custom_field_data[:type]) == "platformCore:SelectCustomFieldRef"
113
+ if type == "platformCore:SelectCustomFieldRef"
110
114
  attrs[:value] = CustomRecordRef.new(custom_field_data[:value])
115
+ elsif type == 'platformCore:MultiSelectCustomFieldRef'
116
+ attrs[:value] = custom_field_data[:value].map do |entry|
117
+ CustomRecordRef.new(entry)
118
+ end
111
119
  end
112
120
 
113
121
  custom_fields << CustomField.new(attrs)
@@ -9,8 +9,8 @@ module NetSuite
9
9
 
10
10
  actions :get, :update, :get_list, :add, :delete, :search, :upsert
11
11
 
12
- fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :created,
13
- :custom_record_id, :description, :disclaimer, :enabl_email_merge, :enable_numbering, :include_name,
12
+ fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :alt_name, :auto_name,
13
+ :created, :custom_record_id, :description, :disclaimer, :enabl_email_merge, :enable_numbering, :include_name,
14
14
  :is_available_offline, :is_inactive, :is_numbering_updateable, :is_ordered, :last_modified, :name,
15
15
  :numbering_current_number, :numbering_init, :numbering_min_digits, :numbering_prefix, :numbering_suffix,
16
16
  :record_name, :script_id, :show_creation_date, :show_creation_date_on_list, :show_id, :show_last_modified_on_list,
@@ -18,7 +18,7 @@ module NetSuite
18
18
 
19
19
  field :custom_field_list, CustomFieldList
20
20
 
21
- record_refs :custom_form, :owner, :rec_type
21
+ record_refs :custom_form, :owner, :rec_type, :parent
22
22
 
23
23
  attr_reader :internal_id
24
24
  attr_accessor :external_id
@@ -40,6 +40,7 @@ module NetSuite
40
40
  def to_record
41
41
  rec = super
42
42
  rec[:@internalId] = @internal_id if @internal_id
43
+ rec[:@externalId] = @external_id if @external_id
43
44
  rec[:@typeId] = @type_id if @type_id
44
45
  rec
45
46
  end
@@ -13,7 +13,7 @@ module NetSuite
13
13
 
14
14
  fields :account_number, :aging, :alt_email, :alt_name, :alt_phone, :bill_pay,
15
15
  :buying_reason, :buying_time_frame, :campaign_category, :click_stream, :comments, :company_name,
16
- :consol_aging, :consol_days_overdue, :contrib_pct, :credit_cards_list, :credit_hold_override,
16
+ :consol_aging, :consol_days_overdue, :contrib_pct, :credit_hold_override,
17
17
  :credit_limit, :date_created, :days_overdue, :default_address,
18
18
  :download_list, :email, :email_preference, :email_transactions, :end_date, :entity_id,
19
19
  :estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
@@ -22,18 +22,19 @@ module NetSuite
22
22
  :opening_balance, :opening_balance_account, :opening_balance_date,
23
23
  :password, :password2, :phone, :phonetic_name, :pref_cc_processor, :print_on_check_as,
24
24
  :print_transactions, :referrer, :reminder_days, :representing_subsidiary, :require_pwd_change, :resale_number,
25
- :sales_group, :sales_readiness, :sales_team_list, :salutation, :send_email, :ship_complete,
25
+ :sales_group, :sales_readiness, :salutation, :send_email, :ship_complete,
26
26
  :stage, :start_date, :sync_partner_teams, :tax_exempt, :taxable,
27
27
  :third_party_acct, :third_party_country, :third_party_zipcode, :title, :url,
28
28
  :vat_reg_number, :visits, :web_lead
29
29
 
30
30
  field :addressbook_list, CustomerAddressbookList
31
+ field :credit_cards_list, CustomerCreditCardsList
31
32
  field :custom_field_list, CustomFieldList
32
33
  field :contact_roles_list, ContactAccessRolesList
33
34
  field :currency_list, CustomerCurrencyList
34
35
  field :partners_list, CustomerPartnersList
35
-
36
- # TODO subscriptions_list
36
+ field :subscriptions_list, CustomerSubscriptionsList
37
+ field :sales_team_list, CustomerSalesTeamList
37
38
 
38
39
  read_only_fields :balance, :consol_balance, :deposit_balance, :consol_deposit_balance, :overdue_balance,
39
40
  :consol_overdue_balance, :unbilled_orders, :consol_unbilled_orders
@@ -0,0 +1,36 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerCreditCards
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+
8
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_1/schema/other/customercreditcards.html?mode=package
9
+
10
+ fields :cc_default, :cc_expire_date, :cc_memo, :cc_name, :cc_number, :debitcard_issue_no, :state_from, :validfrom
11
+ record_refs :card_state, :payment_method
12
+
13
+ attr_reader :internal_id
14
+
15
+ def initialize(attributes_or_record = {})
16
+ case attributes_or_record
17
+ when self.class
18
+ initialize_from_record(attributes_or_record)
19
+ when Hash
20
+ initialize_from_attributes_hash(attributes_or_record)
21
+ end
22
+ end
23
+
24
+ def initialize_from_record(obj)
25
+ self.cc_default = obj.cc_default
26
+ self.cc_expire_date = obj.cc_expire_date
27
+ self.cc_memo = obj.cc_memo
28
+ self.cc_name = obj.cc_name
29
+ self.cc_number = obj.cc_number
30
+ self.debitcard_issue_no = obj.debitcard_issue_no
31
+ self.state_from = obj.state_from
32
+ self.validfrom = obj.validfrom
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,10 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerCreditCardsList < Support::Sublist
4
+ include Namespaces::ListRel
5
+
6
+ sublist :credit_cards, CustomerCreditCards
7
+ alias :credit_card :credit_cards
8
+ end
9
+ end
10
+ end
@@ -13,13 +13,16 @@ module NetSuite
13
13
  actions :get, :get_list, :initialize, :add, :delete, :update, :upsert, :search
14
14
 
15
15
  fields :created_date, :last_modified_date, :status, :payment, :tran_date, :exchange_rate, :undep_funds, :memo,
16
- :check_num, :klass, :currency_name, :is_recurring_payment, :charge_it
16
+ :check_num, :klass, :currency_name, :is_recurring_payment, :tran_id, :auth_code,
17
+ :cc_approved, :cc_avs_street_match, :cc_avs_zip_match, :cc_expire_date, :cc_is_purchase_card_bin, :cc_name, :cc_number,
18
+ :cc_process_as_purchase_card, :cc_security_code, :cc_security_code_match, :cc_street, :cc_zip_code, :charge_it
17
19
 
18
20
  field :custom_field_list, CustomFieldList
19
21
  field :apply_list, CustomerDepositApplyList
22
+ # accountingBookDetailList
20
23
 
21
24
  record_refs :customer, :sales_order, :account, :department, :payment_method,
22
- :custom_form, :currency, :posting_period, :subsidiary,
25
+ :custom_form, :currency, :posting_period, :subsidiary, :location,
23
26
 
24
27
  # only available in an advanced search result
25
28
  :deposit_transaction
@@ -25,6 +25,7 @@ module NetSuite
25
25
 
26
26
  attr_reader :internal_id
27
27
  attr_accessor :external_id
28
+ attr_accessor :search_joins
28
29
 
29
30
  def initialize(attributes = {})
30
31
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -0,0 +1,24 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerSalesTeam
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::ListRel
8
+
9
+ fields :is_primary, :contribution
10
+
11
+ record_refs :sales_role, :employee
12
+
13
+ def initialize(attributes_or_record = {})
14
+ case attributes_or_record
15
+ when Hash
16
+ initialize_from_attributes_hash(attributes_or_record)
17
+ when self.class
18
+ initialize_from_record(attributes_or_record)
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,9 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerSalesTeamList < Support::Sublist
4
+ include Namespaces::ListRel
5
+
6
+ sublist :sales_team, NetSuite::Records::CustomerSalesTeam
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,29 @@
1
+ # http://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2016_2/schema/record/customerstatus.html
2
+
3
+ module NetSuite
4
+ module Records
5
+
6
+ class CustomerStatus
7
+ include Support::Records
8
+ include Support::Fields
9
+ include Support::RecordRefs
10
+ include Support::Actions
11
+ include Namespaces::ListRel
12
+
13
+ actions :get, :add, :delete, :search, :update, :upsert
14
+
15
+ fields :description, :include_in_lead_reports, :is_inactive, :name,
16
+ :probability, :stage
17
+
18
+ attr_reader :internal_id
19
+ attr_accessor :external_id
20
+
21
+ def initialize(attributes = {})
22
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
23
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
24
+ initialize_from_attributes_hash(attributes)
25
+ end
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerSubscription
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Support::RecordRefs
7
+ include Namespaces::ListRel
8
+
9
+ fields :subscribed, :last_modified_date
10
+ record_refs :subscription
11
+
12
+ def initialize(attributes_or_record = {})
13
+ initialize_from_attributes_hash(attributes_or_record)
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerSubscriptionsList < Support::Sublist
4
+ include Namespaces::ListRel
5
+
6
+ sublist :subscriptions, CustomerSubscription
7
+
8
+ end
9
+ end
10
+ end
@@ -19,7 +19,7 @@ module NetSuite
19
19
  :phonetic_name, :purchase_order_approval_limit, :purchase_order_approver, :purchase_order_limit, :release_date,
20
20
  :resident_status, :salutation, :social_security_number, :visa_exp_date, :visa_type
21
21
 
22
- record_refs :currency, :department, :location, :subsidiary, :employee_type, :employee_status, :supervisor
22
+ record_refs :currency, :department, :location, :sales_role, :subsidiary, :employee_type, :employee_status, :supervisor
23
23
 
24
24
  field :custom_field_list, CustomFieldList
25
25
  field :roles_list, RoleList
@@ -0,0 +1,53 @@
1
+ module NetSuite
2
+ module Records
3
+ class EntityCustomField
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::SetupCustom
9
+
10
+ actions :get, :get_list, :add, :delete, :update, :upsert, :upsert_list
11
+
12
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_1/schema/record/entitycustomfield.html
13
+ fields(
14
+ :access_level,
15
+ :applies_to_contact,
16
+ :applies_to_customer,
17
+ :applies_to_employee,
18
+ :applies_to_group,
19
+ :applies_to_other_name,
20
+ :applies_to_partner,
21
+ :applies_to_price_list,
22
+ :applies_to_statement,
23
+ :applies_to_vendor,
24
+ :applies_to_web_site,
25
+ :available_externally,
26
+ :check_spelling,
27
+ :default_checked,
28
+ :display_type,
29
+ :field_type,
30
+ :global_search,
31
+ :is_formula,
32
+ :is_mandatory,
33
+ :is_parent,
34
+ :label,
35
+ :script_id,
36
+ :search_level,
37
+ :show_in_list,
38
+ :store_value,
39
+ )
40
+
41
+ record_refs :owner
42
+
43
+ attr_reader :internal_id
44
+ attr_accessor :external_id
45
+
46
+ def initialize(attributes = {})
47
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
48
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
49
+ initialize_from_attributes_hash(attributes)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,42 @@
1
+ module NetSuite
2
+ module Records
3
+ class Estimate
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::TranSales
9
+
10
+ actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search
11
+
12
+ fields :alt_handling_cost, :alt_sales_total, :alt_shipping_cost, :balance,
13
+ :bill_address, :billing_address, :billing_schedule, :bill_is_residential,
14
+ :created_date, :currency_name, :discount_rate, :email, :end_date,
15
+ :est_gross_profit, :exchange_rate, :handling_cost, :handling_tax1_rate, :is_taxable,
16
+ :last_modified_date, :memo, :message, :other_ref_num, :ship_date, :shipping_cost,
17
+ :shipping_tax1_rate, :source, :start_date, :status, :sync_partner_teams, :sync_sales_teams,
18
+ :to_be_emailed, :to_be_faxed, :to_be_printed, :total_cost_estimate, :tran_date, :tran_id,
19
+ :linked_tracking_numbers, :is_multi_ship_to
20
+
21
+ field :shipping_address, Address
22
+ field :billing_address, Address
23
+
24
+ field :item_list, EstimateItemList
25
+ field :custom_field_list, CustomFieldList
26
+
27
+ record_refs :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item, :entity,
28
+ :handling_tax_code, :job, :klass, :lead_source, :location, :message_sel, :opportunity, :partner,
29
+ :promo_code, :sales_group, :sales_rep, :ship_method, :shipping_tax_code, :subsidiary, :terms
30
+
31
+ attr_reader :internal_id
32
+ attr_accessor :external_id
33
+ attr_accessor :search_joins
34
+
35
+ def initialize(attributes = {})
36
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
37
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
38
+ initialize_from_attributes_hash(attributes)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,40 @@
1
+ module NetSuite
2
+ module Records
3
+ class EstimateItem
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::TranSales
8
+
9
+ fields :amount, :cost_estimate,
10
+ :cost_estimate_type, :defer_rev_rec, :description,
11
+ :is_taxable, :line, :quantity,
12
+ :rate, :tax_rate1
13
+
14
+ field :custom_field_list, CustomFieldList
15
+
16
+ record_refs :item, :job, :price, :tax_code, :units
17
+
18
+ def initialize(attributes_or_record = {})
19
+ case attributes_or_record
20
+ when Hash
21
+ initialize_from_attributes_hash(attributes_or_record)
22
+ when self.class
23
+ initialize_from_record(attributes_or_record)
24
+ end
25
+ end
26
+
27
+ def initialize_from_record(record)
28
+ self.attributes = record.send(:attributes)
29
+ end
30
+
31
+ def to_record
32
+ rec = super
33
+ if rec["#{record_namespace}:customFieldList"]
34
+ rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
35
+ end
36
+ rec
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,11 @@
1
+ module NetSuite
2
+ module Records
3
+ class EstimateItemList < Support::Sublist
4
+ include Namespaces::TranSales
5
+
6
+ sublist :item, EstimateItem
7
+
8
+ alias :items :item
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,33 @@
1
+ module NetSuite
2
+ module Records
3
+ class InboundShipment
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::TranPurch
9
+
10
+ actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :upsert_list, :search, :update_list
11
+
12
+ fields :shipment_number, :external_document_number, :shipment_status, :expected_shipping_date,
13
+ :actual_shipping_date, :expected_delivery_date, :actual_delivery_date, :shipment_memo,
14
+ :vessel_number, :bill_of_lading
15
+
16
+ field :items_list, InboundShipmentItemList
17
+ field :custom_field_list, CustomFieldList
18
+
19
+ record_refs :custom_form
20
+
21
+ attr_reader :internal_id
22
+ attr_accessor :external_id
23
+ attr_accessor :search_joins
24
+
25
+ def initialize(attributes = {})
26
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
27
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
28
+ initialize_from_attributes_hash(attributes)
29
+ end
30
+
31
+ end
32
+ end
33
+ end