netsuite 0.8.6 → 0.8.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +20 -0
  3. data/.ruby-version +1 -1
  4. data/.tool-versions +1 -0
  5. data/Gemfile +1 -6
  6. data/HISTORY.md +38 -0
  7. data/README.md +42 -21
  8. data/Rakefile +1 -1
  9. data/lib/netsuite/configuration.rb +13 -0
  10. data/lib/netsuite/records/accounting_period.rb +2 -2
  11. data/lib/netsuite/records/assembly_unbuild.rb +1 -3
  12. data/lib/netsuite/records/contact.rb +1 -1
  13. data/lib/netsuite/records/cost_category.rb +28 -0
  14. data/lib/netsuite/records/credit_memo.rb +1 -1
  15. data/lib/netsuite/records/currency_rate.rb +1 -1
  16. data/lib/netsuite/records/custom_field_list.rb +9 -3
  17. data/lib/netsuite/records/customer_deposit.rb +5 -5
  18. data/lib/netsuite/records/customer_payment.rb +5 -2
  19. data/lib/netsuite/records/customer_payment_credit.rb +17 -0
  20. data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
  21. data/lib/netsuite/records/estimate.rb +95 -14
  22. data/lib/netsuite/records/inventory_item.rb +62 -1
  23. data/lib/netsuite/records/inventory_number.rb +1 -1
  24. data/lib/netsuite/records/inventory_transfer.rb +1 -0
  25. data/lib/netsuite/records/invoice.rb +98 -5
  26. data/lib/netsuite/records/invoice_item.rb +1 -1
  27. data/lib/netsuite/records/item_fulfillment_item.rb +1 -1
  28. data/lib/netsuite/records/item_receipt_item.rb +3 -2
  29. data/lib/netsuite/records/member_list.rb +0 -2
  30. data/lib/netsuite/records/non_inventory_purchase_item.rb +1 -1
  31. data/lib/netsuite/records/non_inventory_resale_item.rb +1 -1
  32. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  33. data/lib/netsuite/records/opportunity.rb +2 -2
  34. data/lib/netsuite/records/partner.rb +7 -5
  35. data/lib/netsuite/records/phone_call.rb +1 -1
  36. data/lib/netsuite/records/serialized_assembly_item.rb +3 -2
  37. data/lib/netsuite/records/service_resale_item.rb +1 -1
  38. data/lib/netsuite/records/service_sale_item.rb +1 -1
  39. data/lib/netsuite/records/transfer_order_item.rb +1 -1
  40. data/lib/netsuite/records/vendor.rb +6 -5
  41. data/lib/netsuite/records/vendor_currency.rb +26 -0
  42. data/lib/netsuite/records/vendor_currency_list.rb +9 -0
  43. data/lib/netsuite/support/fields.rb +17 -0
  44. data/lib/netsuite/support/records.rb +1 -1
  45. data/lib/netsuite/support/search_result.rb +23 -4
  46. data/lib/netsuite/utilities.rb +1 -0
  47. data/lib/netsuite/version.rb +1 -1
  48. data/lib/netsuite.rb +5 -0
  49. data/netsuite.gemspec +4 -2
  50. data/spec/netsuite/actions/search_spec.rb +22 -0
  51. data/spec/netsuite/configuration_spec.rb +33 -1
  52. data/spec/netsuite/records/basic_record_spec.rb +8 -1
  53. data/spec/netsuite/records/cost_category_spec.rb +105 -0
  54. data/spec/netsuite/records/custom_field_list_spec.rb +40 -2
  55. data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
  56. data/spec/netsuite/records/customer_payment_spec.rb +1 -6
  57. data/spec/netsuite/records/estimate_spec.rb +103 -13
  58. data/spec/netsuite/records/inventory_item_spec.rb +65 -0
  59. data/spec/netsuite/records/invoice_spec.rb +94 -0
  60. data/spec/netsuite/records/partner_spec.rb +6 -4
  61. data/spec/netsuite/records/vendor_spec.rb +1 -1
  62. data/spec/netsuite/support/fields_spec.rb +36 -1
  63. data/spec/support/field_matcher.rb +8 -6
  64. data/spec/support/fixtures/custom_fields/multi_select.xml +47 -0
  65. data/spec/support/fixtures/search/saved_search_item.xml +55 -0
  66. data/spec/support/fixtures/search/saved_search_joined_custom_customer.xml +15 -1
  67. data/spec/support/search_only_field_matcher.rb +7 -0
  68. metadata +42 -16
  69. data/circle.yml +0 -36
@@ -45,13 +45,74 @@ module NetSuite
45
45
  :total_value, :track_landed_cost, :transfer_price, :upc_code, :url_component, :use_bins, :use_marginal_rates,
46
46
  :vendor_name, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :weight, :weight_unit, :weight_units
47
47
 
48
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_2/schema/search/itemsearchrowbasic.html?mode=package
49
+ search_only_fields :acc_book_rev_rec_forecast_rule, :accounting_book,
50
+ :accounting_book_amortization, :accounting_book_create_plans_on,
51
+ :accounting_book_rev_rec_rule, :accounting_book_rev_rec_schedule,
52
+ :allowed_shipping_method, :atp_lead_time, :atp_method, :base_price,
53
+ :bin_number, :bin_on_hand_avail, :bin_on_hand_count, :bom_quantity,
54
+ :build_entire_assembly, :build_time, :buy_it_now_price, :category,
55
+ :category_preferred, :component_yield, :correlated_item,
56
+ :correlated_item_correlation, :correlated_item_count,
57
+ :correlated_item_lift, :correlated_item_purchase_rate,
58
+ :cost_accounting_status, :created, :create_job,
59
+ :cust_return_variance_account, :date_viewed, :days_before_expiration,
60
+ :default_shipping_method, :deferred_expense_account,
61
+ :departmentnohierarchy, :display_ine_bay_store, :e_bay_item_description,
62
+ :e_bay_item_subtitle, :e_bay_item_title, :ebay_relisting_option,
63
+ :effective_bom_control, :effective_date, :effective_revision,
64
+ :end_auctions_when_out_of_stock, :feed_description, :feed_name,
65
+ :froogle_product_feed, :fx_cost, :generate_accruals,
66
+ :gift_cert_auth_code, :gift_cert_email, :gift_cert_expiration_date,
67
+ :gift_cert_from, :gift_cert_message, :gift_cert_original_amount,
68
+ :gift_cert_recipient, :hierarchy_node, :hierarchy_version, :hits,
69
+ :image_url, :interco_expense_account, :inventory_location,
70
+ :is_available, :is_fulfillable, :is_lot_item, :is_serial_item,
71
+ :is_special_work_order_item, :is_vsoe_bundle, :is_wip, :item_url,
72
+ :last_quantity_available_change, :liability_account, :listing_duration,
73
+ :location_allow_store_pickup, :location_atp_lead_time,
74
+ :location_average_cost, :location_bin_quantity_available,
75
+ :location_build_time, :location_cost, :location_cost_accounting_status,
76
+ :location_default_return_cost, :location_demand_source,
77
+ :location_demand_time_fence, :location_fixed_lot_size,
78
+ :location_inventory_cost_template, :location_invt_classification,
79
+ :location_invt_count_interval, :location_last_invt_count_date,
80
+ :location_lead_time, :location_next_invt_count_date,
81
+ :location_periodic_lot_size_days, :location_periodic_lot_size_type,
82
+ :location_preferred_stock_level, :location_qty_avail_for_store_pickup,
83
+ :location_quantity_available, :location_quantity_back_ordered,
84
+ :location_quantity_committed, :location_quantity_in_transit,
85
+ :location_quantity_on_hand, :location_quantity_on_order,
86
+ :location_re_order_point, :location_reschedule_in_days,
87
+ :location_reschedule_out_days, :location_safety_stock_level,
88
+ :location_store_pickup_buffer_stock, :location_supply_lot_sizing_method,
89
+ :location_supply_time_fence, :location_supply_type,
90
+ :location_total_value, :loc_backward_consumption_days,
91
+ :loc_forward_consumption_days, :manufacturing_charge_item, :member_item,
92
+ :member_quantity, :modified, :moss_applies, :nextag_product_feed,
93
+ :num_active_listings, :number_allowed_downloads, :num_currently_listed,
94
+ :obsolete_date, :obsolete_revision, :online_customer_price,
95
+ :online_price, :other_prices, :other_vendor, :overhead_type,
96
+ :preferred_bin, :primary_category, :prod_price_variance_acct,
97
+ :prod_qty_variance_acct, :reserve_price,
98
+ :same_as_primary_book_amortization,
99
+ :same_as_primary_book_rev_rec, :scrap_acct, :sell_on_ebay,
100
+ :serial_number, :serial_number_location, :shipping_carrier,
101
+ :shipping_rate, :shopping_product_feed, :shopzilla_product_feed,
102
+ :starting_price, :subsidiary, :sub_type,
103
+ :thumb_nail_url, :type, :unbuild_variance_account, :use_component_yield,
104
+ :vendor_code, :vendor_cost, :vendor_cost_entered,
105
+ :vendor_price_currency, :vendor_schedule, :vend_return_variance_account,
106
+ :web_site, :wip_acct, :wip_variance_acct, :yahoo_product_feed
107
+
48
108
  record_refs :alternate_demand_source_item, :asset_account, :bill_exch_rate_variance_acct, :bill_price_variance_acct,
49
109
  :bill_qty_variance_acct, :billing_schedule, :cogs_account, :cost_category, :custom_form, :deferred_revenue_account,
50
110
  :demand_source, :department, :expense_account, :gain_loss_account, :income_account, :issue_product, :klass, :location,
51
111
  :parent, :preferred_location, :pricing_group, :purchase_price_variance_acct, :purchase_tax_code, :purchase_unit,
52
112
  :quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :ship_package, :soft_descriptor,
53
113
  :stock_unit, :store_display_image, :store_display_thumbnail, :store_item_template, :supply_lot_sizing_method,
54
- :supply_replenishment_method, :supply_type, :tax_schedule, :units_type, :vendor
114
+ :supply_replenishment_method, :supply_type, :tax_schedule, :units_type, :vendor, :create_revenue_plans_on,
115
+ :revenue_recognition_rule, :rev_rec_forecast_rule
55
116
 
56
117
  field :pricing_matrix, PricingMatrix
57
118
  field :custom_field_list, CustomFieldList
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
- actions :get, :search
10
+ actions :get, :search, :update
11
11
 
12
12
  fields :expiration_date, :inventory_number, :isonhand, :memo, :status, :units, :location,
13
13
  :quantityavailable, :quantityintransit, :quantityonhand, :quantityonorder
@@ -12,6 +12,7 @@ module NetSuite
12
12
  fields :klass, :created_date, :last_modified_date, :tran_date, :tran_id, :memo
13
13
 
14
14
  field :inventory_list, InventoryTransferInventoryList
15
+ field :custom_field_list, CustomFieldList
15
16
 
16
17
  record_refs :posting_period, :location, :transfer_location, :department,
17
18
  :subsidiary
@@ -11,8 +11,8 @@ module NetSuite
11
11
 
12
12
  actions :get, :get_deleted, :get_list, :initialize, :add, :update, :delete, :upsert, :upsert_list, :search
13
13
 
14
- fields :balance, :bill_address,
15
- :billing_schedule, :contrib_pct, :created_date, :currency_name, :custom_field_list,
14
+ fields :balance,
15
+ :billing_schedule, :contrib_pct, :created_date, :currency_name,
16
16
  :deferred_revenue, :discount_amount, :discount_date, :discount_rate,
17
17
  :due_date, :email, :end_date, :est_gross_profit, :est_gross_profit_percent, :exchange_rate,
18
18
  :exclude_commission, :exp_cost_disc_amount, :exp_cost_disc_print, :exp_cost_disc_rate, :exp_cost_disc_tax_1_amt,
@@ -24,13 +24,13 @@ module NetSuite
24
24
  :linked_tracking_numbers, :memo, :message, :message_sel, :on_credit_hold, :opportunity,
25
25
  :other_ref_num, :partners_list, :rev_rec_end_date,
26
26
  :rev_rec_on_rev_commitment, :rev_rec_schedule, :rev_rec_start_date, :revenue_status, :sales_effective_date,
27
- :sales_group, :sales_team_list, :ship_address, :ship_date, :ship_group_list,
27
+ :sales_group, :sales_team_list, :ship_date, :ship_group_list,
28
28
  :shipping_cost, :shipping_tax_1_rate, :shipping_tax_2_rate, :shipping_tax_code, :source, :start_date,
29
29
  :status, :sync_partner_teams, :sync_sales_teams, :tax_2_total,
30
30
  :tax_total, :time_disc_amount, :time_disc_print, :time_disc_rate, :time_disc_tax_1_amt, :time_disc_taxable,
31
31
  :time_discount, :time_list, :time_tax_code, :time_tax_rate_1, :time_tax_rate_2, :to_be_emailed, :to_be_faxed,
32
32
  :to_be_printed, :total_cost_estimate, :tracking_numbers, :tran_date, :tran_id, :tran_is_vsoe_bundle,
33
- :transaction_bill_address, :transaction_ship_address, :vat_reg_num, :vsoe_auto_calc, :tax_rate
33
+ :vat_reg_num, :vsoe_auto_calc, :tax_rate
34
34
 
35
35
  field :transaction_bill_address, BillAddress
36
36
  field :transaction_ship_address, ShipAddress
@@ -39,9 +39,102 @@ module NetSuite
39
39
  field :shipping_address, Address
40
40
  field :billing_address, Address
41
41
 
42
- read_only_fields :sub_total, :discount_total, :total, :recognized_revenue, :amount_remaining, :amount_paid, :amount,
42
+ read_only_fields :sub_total, :discount_total, :total, :recognized_revenue, :amount_remaining, :amount_paid,
43
43
  :alt_shipping_cost, :gift_cert_applied, :handling_cost, :alt_handling_cost
44
44
 
45
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_2/schema/search/transactionsearchrowbasic.html?mode=package
46
+ search_only_fields :abbrev, :account_type, :acct_corp_card_exp,
47
+ :actual_production_end_date, :actual_production_start_date,
48
+ :actual_ship_date, :alt_sales_amount, :alt_sales_net_amount, :amount,
49
+ :amount_unbilled, :applied_to_foreign_amount,
50
+ :applied_to_is_fx_variance, :applied_to_link_amount,
51
+ :applied_to_link_type, :applied_to_transaction,
52
+ :applying_foreign_amount, :applying_is_fx_variance,
53
+ :applying_link_amount, :applying_link_type, :applying_transaction,
54
+ :auth_code, :auto_calculate_lag, :avs_street_match, :avs_zip_match,
55
+ :billable, :bill_address, :bill_address1, :bill_address2,
56
+ :bill_address3, :bill_addressee, :bill_attention, :bill_city,
57
+ :bill_country, :bill_country_code, :billed_date, :billing_amount,
58
+ :billing_transaction, :bill_phone, :bill_state, :bill_variance_status,
59
+ :bill_zip, :bin_number, :bin_number_quantity, :bom_quantity,
60
+ :build_entire_assembly, :build_variance, :built,
61
+ :can_have_stackable_promotions, :catch_up_period, :cc_customer_code,
62
+ :cc_exp_date, :cc_holder_name, :cc_number, :cc_street, :cc_zip_code,
63
+ :cleared, :closed, :close_date, :cogs_amount,
64
+ :commission_effective_date, :commit, :component_yield,
65
+ :confirmation_number, :contribution, :contribution_primary,
66
+ :cost_component_amount, :cost_component_category, :cost_component_item,
67
+ :cost_component_quantity, :cost_component_standard_cost, :cost_estimate,
68
+ :cost_estimate_rate, :cost_estimate_type, :created_by, :credit_amount,
69
+ :csc_match, :custom_gl, :cust_type, :date_created, :days_open,
70
+ :days_overdue, :debit_amount, :defer_rev_rec, :deposit_date,
71
+ :deposit_transaction, :doc_unit, :dr_account, :effective_rate,
72
+ :entity_status, :est_gross_profit_pct, :exclude_from_rate_request,
73
+ :expected_close_date, :expected_receipt_date, :expense_category,
74
+ :expense_date, :firmed, :forecast_type, :fulfilling_transaction,
75
+ :fx_account, :fx_amount, :fx_cost_estimate, :fx_cost_estimate_rate,
76
+ :fx_est_gross_profit, :fx_tran_cost_estimate, :fx_vsoe_allocation,
77
+ :fx_vsoe_amount, :fx_vsoe_price, :gco_availabel_to_charge,
78
+ :gco_available_to_refund, :gco_avs_street_match, :gco_avs_zip_match,
79
+ :gco_buyer_account_age, :gco_buyer_ip, :gco_charge_amount,
80
+ :gco_chargeback_amount, :gco_confirmed_charged_total,
81
+ :gco_confirmed_refunded_total, :gco_creditcard_number, :gco_csc_match,
82
+ :gco_financial_state, :gco_fulfillment_state, :gco_order_id,
83
+ :gco_order_total, :gco_promotion_amount, :gco_promotion_name,
84
+ :gco_refund_amount, :gco_shipping_total, :gco_state_changed_detail,
85
+ :gift_cert, :gross_amount, :include_in_forecast, :incoterm,
86
+ :interco_status, :interco_transaction, :inventory_location,
87
+ :inventory_subsidiary, :in_vsoe_bundle, :is_allocation, :is_backflush,
88
+ :is_gco_chargeback, :is_gco_charge_confirmed,
89
+ :is_gco_payment_guaranteed, :is_gco_refund_confirmed,
90
+ :is_inside_delivery, :is_inside_pickup, :is_intercompany_adjustment,
91
+ :is_in_transit_payment, :is_multi_ship_to, :is_reversal,
92
+ :is_rev_rec_transaction, :is_scrap, :is_ship_address,
93
+ :is_transfer_price_costing, :is_wip, :item, :item_fulfillment_choice,
94
+ :item_revision, :landed_cost_per_line, :line, :line_sequence_number,
95
+ :line_unique_key, :location_auto_assigned, :main_line, :main_name,
96
+ :manufacturing_routing, :match_bill_to_receipt, :memo_main, :memorized,
97
+ :merchant_account, :multi_subsidiary, :net_amount, :net_amount_no_tax,
98
+ :next_bill_date, :no_auto_assign_location, :non_reimbursable,
99
+ :one_time_total, :options, :order_allocation_strategy, :order_priority,
100
+ :originator, :overhead_parent_item,
101
+ :override_installments, :package_count, :paid_amount, :paid_transaction,
102
+ :partner_contribution, :partner_role, :partner_team_member,
103
+ :paying_amount, :paying_transaction, :payment_approved,
104
+ :payment_event_date, :payment_event_hold_reason,
105
+ :payment_event_purchase_card_used, :payment_event_purchase_data_sent,
106
+ :payment_event_result, :payment_event_type, :payment_hold,
107
+ :payment_method, :payment_option, :pay_pal_pending, :pay_pal_status,
108
+ :pay_pal_tran_id, :payroll_batch, :pn_ref_num, :po_rate, :posting,
109
+ :price_level, :print, :probability, :projected_amount, :project_task,
110
+ :purchase_order, :quantity, :quantity_billed, :quantity_committed,
111
+ :quantity_packed, :quantity_picked, :quantity_rev_committed,
112
+ :quantity_ship_recv, :quantity_uom, :rate,
113
+ :realized_gain_posting_transaction, :recur_annually_total,
114
+ :recur_monthly_total, :recur_quarterly_total, :recur_weekly_total,
115
+ :ref_number, :requested_date, :rev_commit_status,
116
+ :rev_committing_transaction, :reversal_date, :reversal_number,
117
+ :rg_account, :rg_amount, :sales_order, :sales_team_member,
118
+ :sales_team_role, :scheduling_method, :serial_number,
119
+ :serial_number_cost, :serial_number_cost_adjustment,
120
+ :serial_number_quantity, :serial_numbers, :ship_address, :ship_address1,
121
+ :ship_address2, :ship_address3, :ship_addressee, :ship_attention,
122
+ :ship_carrier, :ship_city, :ship_complete, :ship_country,
123
+ :ship_country_code, :ship_group, :ship_phone, :shipping_amount,
124
+ :ship_recv_status_line, :ship_state, :ship_to, :ship_zip,
125
+ :signed_amount, :subscription, :subscription_line, :tax_amount,
126
+ :tax_code, :tax_line, :tax_period, :term_in_months, :terms_of_sale,
127
+ :title, :to_subsidiary, :tran_est_gross_profit,
128
+ :tran_fx_est_gross_profit, :transaction_discount,
129
+ :transaction_line_type, :transaction_number, :transfer_location,
130
+ :transfer_order_item_line, :transfer_order_quantity_committed,
131
+ :transfer_order_quantity_packed, :transfer_order_quantity_picked,
132
+ :transfer_order_quantity_received, :transfer_order_quantity_shipped,
133
+ :type, :unit, :unit_cost_override, :vend_type, :visible_to_customer,
134
+ :vsoe_allocation, :vsoe_amount, :vsoe_deferral, :vsoe_delivered,
135
+ :vsoe_permit_discount, :vsoe_price, :web_site
136
+ # TODO: Add record_type, conflicts with Support::Records#record_type, returns "invoice" versus "tranSales:Invoice"
137
+
45
138
  record_refs :account, :bill_address_list, :custom_form, :department, :entity, :klass, :partner,
46
139
  :posting_period, :ship_address_list, :terms, :location, :sales_rep, :tax_item, :created_from,
47
140
  :ship_method, :lead_source, :promo_code, :subsidiary, :currency, :approval_status, :job, :discount_item
@@ -9,7 +9,7 @@ module NetSuite
9
9
  fields :amount, :amount_ordered, :bin_numbers, :cost_estimate, :cost_estimate_type, :current_percent,
10
10
  :defer_rev_rec, :description, :gift_cert_from, :gift_cert_message, :gift_cert_number, :gift_cert_recipient_email,
11
11
  :gift_cert_recipient_name, :gross_amt, :inventory_detail, :is_taxable, :item_is_fulfilled, :license_code, :line,
12
- :klass, :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled,
12
+ :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled,
13
13
  :quantity_on_hand, :quantity_ordered, :rate, :rev_rec_end_date, :rev_rec_start_date,
14
14
  :serial_numbers, :ship_group, :tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral,
15
15
  :vsoe_delivered, :vsoe_permit_discount, :vsoe_price
@@ -9,7 +9,7 @@ module NetSuite
9
9
  fields :amount, :amount_ordered, :bin_numbers, :cost_estimate, :cost_estimate_type, :current_percent,
10
10
  :defer_rev_rec, :description, :gift_cert_from, :gift_cert_message, :gift_cert_number, :gift_cert_recipient_email,
11
11
  :gift_cert_recipient_name, :gross_amt, :inventory_detail, :is_taxable, :item_is_fulfilled, :license_code, :line,
12
- :klass, :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled,
12
+ :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled,
13
13
  :quantity_on_hand, :quantity_ordered, :rate, :rev_rec_end_date, :rev_rec_start_date,
14
14
  :serial_numbers, :ship_group, :tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral,
15
15
  :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :item_receive
@@ -7,15 +7,16 @@ module NetSuite
7
7
  include Namespaces::TranPurch
8
8
 
9
9
  fields :bin_numbers, :currency, :description, :expiration_date, :is_drop_shipment,
10
- :item_name, :item_receive, :job_name, :line, :on_hand, :options, :order_line,
10
+ :item_name, :item_receive, :job_name, :line, :on_hand, :order_line,
11
11
  :quantity, :quantity_remaining, :rate, :restock, :serial_numbers,
12
12
  :unit_cost_override, :units_display
13
13
 
14
- record_refs :bill_variance_status, :inventory_detail, :item, :landed_cost,
14
+ record_refs :bill_variance_status, :item, :landed_cost,
15
15
  :location
16
16
 
17
17
  field :options, CustomFieldList
18
18
  field :custom_field_list, CustomFieldList
19
+ field :inventory_detail, InventoryDetail
19
20
 
20
21
  def initialize(attributes_or_record = {})
21
22
  case attributes_or_record
@@ -3,8 +3,6 @@ module NetSuite
3
3
  class MemberList < Support::Sublist
4
4
  include Namespaces::ListAcct
5
5
 
6
- fields :replace_all
7
-
8
6
  sublist :item_member, ItemMember
9
7
 
10
8
  end
@@ -17,7 +17,7 @@ module NetSuite
17
17
  :manufacturer_zip, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity,
18
18
  :minimum_quantity_units, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support,
19
19
  :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title,
20
- :preference_criterion, :presentation_item_list, :prices_include_tax, :pricing_matrix, :producer, :product_feed_list,
20
+ :preference_criterion, :presentation_item_list, :prices_include_tax, :producer, :product_feed_list,
21
21
  :rate, :related_items_description, :sales_description, :schedule_b_code, :schedule_b_number, :schedule_b_quantity,
22
22
  :search_keywords, :ship_individually, :shipping_cost, :shipping_cost_units, :shopping_dot_com_category,
23
23
  :shopzilla_category_id, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor,
@@ -17,7 +17,7 @@ module NetSuite
17
17
  :manufacturer_zip, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity,
18
18
  :minimum_quantity_units, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support,
19
19
  :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title,
20
- :preference_criterion, :presentation_item_list, :prices_include_tax, :pricing_matrix, :producer, :product_feed_list,
20
+ :preference_criterion, :presentation_item_list, :prices_include_tax, :producer, :product_feed_list,
21
21
  :rate, :related_items_description, :sales_description, :schedule_b_code, :schedule_b_number, :schedule_b_quantity,
22
22
  :search_keywords, :ship_individually, :shipping_cost, :shipping_cost_units, :shopping_dot_com_category,
23
23
  :shopzilla_category_id, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor,
@@ -17,7 +17,7 @@ module NetSuite
17
17
  :manufacturer_zip, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity,
18
18
  :minimum_quantity_units, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support,
19
19
  :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title,
20
- :preference_criterion, :presentation_item_list, :prices_include_tax, :pricing_matrix, :producer, :product_feed_list,
20
+ :preference_criterion, :presentation_item_list, :prices_include_tax, :producer, :product_feed_list,
21
21
  :rate, :related_items_description, :sales_description, :schedule_b_code, :schedule_b_number, :schedule_b_quantity,
22
22
  :search_keywords, :ship_individually, :shipping_cost, :shipping_cost_units, :shopping_dot_com_category,
23
23
  :shopzilla_category_id, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor,
@@ -17,7 +17,7 @@ module NetSuite
17
17
  :memo, :probability, :proj_alt_sales_amt, :projected_total,
18
18
  :range_high, :range_low,
19
19
  :ship_is_residential, :source, :status, :sync_partner_teams, :sync_sales_teams,
20
- :tax2_total, :tax_total, :title, :total_cost_estimate, :tran_date, :tran_id,
20
+ :tax2_total, :title, :total_cost_estimate, :tran_date, :tran_id,
21
21
  :vat_reg_num, :weighted_total
22
22
 
23
23
  field :ship_address, ShipAddress
@@ -43,4 +43,4 @@ module NetSuite
43
43
 
44
44
  end
45
45
  end
46
- end
46
+ end
@@ -8,15 +8,17 @@ module NetSuite
8
8
  include Support::RecordRefs
9
9
  include Namespaces::ListRel
10
10
 
11
- # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/partner.html
11
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_2/schema/record/partner.html
12
12
 
13
13
  actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :search
14
14
 
15
- fields :phone, :home_phone, :first_name, :last_name, :alt_name, :is_inactive, :email, :give_access,
16
- :partner_code, :is_person, :company_name, :eligible_for_commission, :entity_id, :last_modified_date,
17
- :date_created, :title, :mobile_phone, :comments, :middle_name, :send_email, :password, :password2
15
+ fields :alt_email, :alt_name, :bcn, :comments, :company_name, :date_created, :default_address,
16
+ :eligible_for_commission, :email, :entity_id, :fax, :first_name, :give_access, :home_phone, :is_inactive,
17
+ :is_person, :last_modified_date, :last_name, :login_as, :middle_name, :mobile_phone, :partner_code,
18
+ :password, :password2, :phone, :phonetic_name, :print_on_check_as, :referring_url, :require_pwd_change,
19
+ :salutation, :send_email, :sub_partner_login, :tax_id_num, :title, :url, :vat_reg_number
18
20
 
19
- record_refs :klass, :access_role, :department, :subsidiary
21
+ record_refs :access_role, :klass, :custom_form, :default_tax_reg, :department, :image, :location, :parent, :subsidiary
20
22
 
21
23
  attr_reader :internal_id
22
24
  attr_accessor :external_id
@@ -10,7 +10,7 @@ module NetSuite
10
10
  actions :get, :get_list, :add, :delete, :update, :upsert
11
11
 
12
12
  fields :title, :message, :phone, :status, :priority, :start_date, :end_date,
13
- :start_time, :end_time, :completed_date, :timed_event, :access_level, :timed_event
13
+ :start_time, :end_time, :completed_date, :timed_event, :access_level
14
14
 
15
15
  field :contact_list, ContactList
16
16
 
@@ -61,7 +61,6 @@ module NetSuite
61
61
  :hazmat_packing_group,
62
62
  :hazmat_shipping_name,
63
63
  :include_children,
64
- :income_account,
65
64
  :interco_cogs_account,
66
65
  :interco_income_account,
67
66
  :invt_classification,
@@ -181,7 +180,6 @@ module NetSuite
181
180
  :store_display_name,
182
181
  :store_display_thumbnail,
183
182
  :store_item_template,
184
- :subsidiary_list,
185
183
  :supply_lot_sizing_method,
186
184
  :supply_replenishment_method,
187
185
  :supply_time_fence,
@@ -209,6 +207,8 @@ module NetSuite
209
207
  :wip_acct,
210
208
  :wip_variance_acct
211
209
 
210
+ record_refs :income_account
211
+
212
212
  # accountingBookDetailList ItemAccountingBookDetailList
213
213
  # binNumberList InventoryItemBinNumberList
214
214
  # itemOptionsList ItemOptionsList
@@ -220,6 +220,7 @@ module NetSuite
220
220
  # siteCategoryList SiteCategoryList
221
221
  # translationsList TranslationList
222
222
 
223
+ field :subsidiary_list, RecordRefList
223
224
  field :custom_field_list, CustomFieldList
224
225
 
225
226
  attr_reader :internal_id
@@ -15,7 +15,7 @@ module NetSuite
15
15
  :item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html,
16
16
  :minimum_quantity, :minimum_quantity_units, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
17
17
  :out_of_stock_message, :overall_quantity_pricing_type, :page_title, :presentation_item_list, :prices_include_tax,
18
- :pricing_matrix, :rate, :related_items_description, :sales_description, :search_keywords,
18
+ :rate, :related_items_description, :sales_description, :search_keywords,
19
19
  :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description,
20
20
  :store_description, :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component,
21
21
  :use_marginal_rates, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :vsoe_sop_group
@@ -15,7 +15,7 @@ module NetSuite
15
15
  :item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html,
16
16
  :minimum_quantity, :minimum_quantity_units, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
17
17
  :out_of_stock_message, :overall_quantity_pricing_type, :page_title, :presentation_item_list, :prices_include_tax,
18
- :pricing_matrix, :rate, :related_items_description, :sales_description, :search_keywords,
18
+ :rate, :related_items_description, :sales_description, :search_keywords,
19
19
  :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description,
20
20
  :store_description, :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component,
21
21
  :use_marginal_rates, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :vsoe_sop_group
@@ -8,7 +8,7 @@ module NetSuite
8
8
 
9
9
  fields :amount, :average_cost, :klass, :commit_inventory, :description,
10
10
  :expected_receipt_date, :expected_ship_date, :inventory_detail, :is_closed, :last_purchase_price,
11
- :line, :options, :order_priority, :quantity, :quantity_available,
11
+ :line, :order_priority, :quantity, :quantity_available,
12
12
  :quantity_back_ordered, :quantity_committed, :quantity_fulfilled,
13
13
  :quantity_on_hand, :quantity_packed, :quantity_picked, :quantity_received,
14
14
  :rate, :serial_numbers
@@ -9,19 +9,20 @@ module NetSuite
9
9
 
10
10
  actions :get, :get_list, :add, :update, :upsert, :delete, :search
11
11
 
12
- fields :account_number, :alt_email, :alt_name, :alt_phone, :balance,
13
- :balance_primary, :bcn, :bill_pay, :comments, :company_name, :credit_limit,
14
- :currency_list, :date_created, :default_address, :eligible_for_commission,
12
+ fields :account_number, :alt_email, :alt_name, :alt_phone,
13
+ :bcn, :bill_pay, :comments, :company_name, :credit_limit,
14
+ :date_created, :default_address, :eligible_for_commission,
15
15
  :email, :email_preference, :email_transactions, :entity_id, :fax, :fax_transactions,
16
16
  :first_name, :give_access, :global_subscription_status, :home_phone, :is1099_eligible,
17
17
  :is_accountant, :is_inactive, :is_job_resource_vend, :is_person, :labor_cost,
18
- :last_modified_date, :last_name, :legal_name, :middle_name, :mobile_phone, :opening_balance,
18
+ :last_name, :legal_name, :middle_name, :mobile_phone, :opening_balance,
19
19
  :opening_balance_date, :password, :password2, :phone, :phonetic_name, :pricing_schedule_list,
20
20
  :print_on_check_as, :print_transactions, :require_pwd_change, :roles_list, :salutation,
21
- :send_email, :subscriptions_list, :tax_id_num, :title, :unbilled_orders, :unbilled_orders_primary,
21
+ :send_email, :subscriptions_list, :tax_id_num, :title,
22
22
  :url, :vat_reg_number
23
23
 
24
24
  field :custom_field_list, CustomFieldList
25
+ field :currency_list, VendorCurrencyList
25
26
  # TODO should change name to VendorAddressBookList
26
27
  field :addressbook_list, CustomerAddressbookList
27
28
 
@@ -0,0 +1,26 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorCurrency
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::ListRel
8
+
9
+ fields :balance, :consol_balance, :consol_deposit_balance, :consol_overdue_balance,
10
+ :consol_unbilled_orders, :deposit_balance, :display_symbol, :overdue_balance,
11
+ :override_currency_format, :symbol_placement, :unbilled_orders
12
+
13
+ record_refs :currency
14
+
15
+ def initialize(attributes_or_record = {})
16
+ case attributes_or_record
17
+ when Hash
18
+ initialize_from_attributes_hash(attributes_or_record)
19
+ when self.class
20
+ initialize_from_record(attributes_or_record)
21
+ end
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorCurrencyList < Support::Sublist
4
+ include Namespaces::ListRel
5
+
6
+ sublist :vendor_currency, NetSuite::Records::VendorCurrency
7
+ end
8
+ end
9
+ end
@@ -21,6 +21,7 @@ module NetSuite
21
21
 
22
22
  def field(name, klass = nil)
23
23
  name_sym = name.to_sym
24
+ raise "#{name} already defined on #{self.name}" if fields.include?(name_sym)
24
25
  fields << name_sym
25
26
  if klass
26
27
  define_method(name_sym) do
@@ -60,6 +61,22 @@ module NetSuite
60
61
  read_only_fields << name_sym
61
62
  field name
62
63
  end
64
+
65
+ def search_only_fields(*args)
66
+ if args.empty?
67
+ @search_only_fields ||= Set.new
68
+ else
69
+ args.each do |arg|
70
+ search_only_field arg
71
+ end
72
+ end
73
+ end
74
+
75
+ def search_only_field(name)
76
+ name_sym = name.to_sym
77
+ search_only_fields << name_sym
78
+ field name
79
+ end
63
80
  end
64
81
 
65
82
  end
@@ -5,7 +5,7 @@ module NetSuite
5
5
  include Namespaces::PlatformCore
6
6
 
7
7
  def to_record
8
- attributes.reject { |k,v| self.class.read_only_fields.include?(k) }.inject({}) do |hash, (k,v)|
8
+ attributes.reject { |k,v| self.class.read_only_fields.include?(k) || self.class.search_only_fields.include?(k) }.inject({}) do |hash, (k,v)|
9
9
  kname = "#{record_namespace}:"
10
10
  kname += k == :klass ? 'class' : k.to_s.lower_camelcase
11
11
 
@@ -52,9 +52,6 @@ module NetSuite
52
52
  record_list = [record_list] unless record_list.is_a?(Array)
53
53
 
54
54
  record_list.each do |record|
55
- # TODO because of customFieldList we need to either make this recursive
56
- # or handle the customFieldList as a special case
57
-
58
55
  record.each_pair do |search_group, search_data|
59
56
  # skip all attributes: look for :basic and all :xxx_join
60
57
  next if search_group.to_s.start_with?('@')
@@ -63,7 +60,25 @@ module NetSuite
63
60
  # all return values are wrapped in a <SearchValue/>
64
61
  # extract the value from <SearchValue/> to make results easier to work with
65
62
 
66
- if v.is_a?(Hash) && v.has_key?(:search_value)
63
+ if k == :custom_field_list
64
+ # Here's an example of a response
65
+
66
+ # <platformCommon:customFieldList>
67
+ # <platformCore:customField internalId="1756" scriptId="custitem_stringfield" xsi:type="platformCore:SearchColumnStringCustomField">
68
+ # <platformCore:searchValue>sample string value</platformCore:searchValue>
69
+ # </platformCore:customField>
70
+ # <platformCore:customField internalId="1713" scriptId="custitem_apcategoryforsales" xsi:type="platformCore:SearchColumnSelectCustomField">
71
+ # <platformCore:searchValue internalId="4" typeId="464"/>
72
+ # </platformCore:customField>
73
+ # </platformCommon:customFieldList>
74
+
75
+ custom_field_list = v.fetch(:custom_field)
76
+ custom_field_list = [custom_field_list] unless custom_field_list.is_a?(Array)
77
+ record[search_group][k][:custom_field] = custom_field_list.map do |custom_field|
78
+ custom_field[:value] = custom_field.fetch(:search_value)
79
+ custom_field
80
+ end
81
+ elsif v.is_a?(Hash) && v.has_key?(:search_value)
67
82
  # Here's an example of a record ref and string response
68
83
 
69
84
  # <platformCommon:entity>
@@ -89,6 +104,10 @@ module NetSuite
89
104
  record[:basic][:internal_id] = record[:basic][:internal_id][:@internal_id]
90
105
  end
91
106
 
107
+ if record[:basic][:external_id]
108
+ record[:basic][:external_id] = record[:basic][:external_id][:@external_id]
109
+ end
110
+
92
111
  result_wrapper = result_class.new(record.delete(:basic))
93
112
  result_wrapper.search_joins = record
94
113
  results << result_wrapper
@@ -173,6 +173,7 @@ module NetSuite
173
173
  ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::GiftCertificateItem, ns_item_internal_id, opts)
174
174
  ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::KitItem, ns_item_internal_id, opts)
175
175
  ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::SerializedInventoryItem, ns_item_internal_id, opts)
176
+ ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::SerializedAssemblyItem, ns_item_internal_id, opts)
176
177
  ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::LotNumberedAssemblyItem, ns_item_internal_id, opts)
177
178
  ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::LotNumberedInventoryItem, ns_item_internal_id, opts)
178
179
 
@@ -1,3 +1,3 @@
1
1
  module NetSuite
2
- VERSION = '0.8.6'
2
+ VERSION = '0.8.10'
3
3
  end
data/lib/netsuite.rb CHANGED
@@ -95,6 +95,7 @@ module NetSuite
95
95
  autoload :CashRefundItemList, 'netsuite/records/cash_refund_item_list'
96
96
  autoload :Campaign, 'netsuite/records/campaign'
97
97
  autoload :Classification, 'netsuite/records/classification'
98
+ autoload :CostCategory, 'netsuite/records/cost_category'
98
99
  autoload :CreditMemo, 'netsuite/records/credit_memo'
99
100
  autoload :CreditMemoApply, 'netsuite/records/credit_memo_apply'
100
101
  autoload :CreditMemoApplyList, 'netsuite/records/credit_memo_apply_list'
@@ -123,6 +124,8 @@ module NetSuite
123
124
  autoload :CustomerPayment, 'netsuite/records/customer_payment'
124
125
  autoload :CustomerPaymentApply, 'netsuite/records/customer_payment_apply'
125
126
  autoload :CustomerPaymentApplyList, 'netsuite/records/customer_payment_apply_list'
127
+ autoload :CustomerPaymentCredit, 'netsuite/records/customer_payment_credit'
128
+ autoload :CustomerPaymentCreditList, 'netsuite/records/customer_payment_credit_list'
126
129
  autoload :CustomerPartner, 'netsuite/records/customer_partner'
127
130
  autoload :CustomerRefund, 'netsuite/records/customer_refund'
128
131
  autoload :CustomerRefundApply, 'netsuite/records/customer_refund_apply'
@@ -297,6 +300,8 @@ module NetSuite
297
300
  autoload :VendorCreditItemList, 'netsuite/records/vendor_credit_item_list'
298
301
  autoload :VendorCreditExpense, 'netsuite/records/vendor_credit_expense'
299
302
  autoload :VendorCreditExpenseList, 'netsuite/records/vendor_credit_expense_list'
303
+ autoload :VendorCurrencyList, 'netsuite/records/vendor_currency_list'
304
+ autoload :VendorCurrency, 'netsuite/records/vendor_currency'
300
305
  autoload :VendorReturnAuthorization, 'netsuite/records/vendor_return_authorization'
301
306
  autoload :VendorReturnAuthorizationItem, 'netsuite/records/vendor_return_authorization_item'
302
307
  autoload :VendorReturnAuthorizationItemList, 'netsuite/records/vendor_return_authorization_item_list'
data/netsuite.gemspec CHANGED
@@ -15,8 +15,10 @@ Gem::Specification.new do |gem|
15
15
  gem.name = 'netsuite'
16
16
  gem.require_paths = ['lib']
17
17
  gem.version = NetSuite::VERSION
18
+ gem.metadata['changelog_uri'] = 'https://github.com/netsweet/netsuite/blob/master/HISTORY.md'
18
19
 
19
- gem.add_dependency 'savon', '>= 2.3.0', '<= 2.11.1'
20
+ gem.add_dependency 'savon', '>= 2.3.0'
20
21
 
21
- gem.add_development_dependency 'rspec', '~> 3.8.0'
22
+ gem.add_development_dependency 'rspec', '~> 3.10.0'
23
+ gem.add_development_dependency 'rake'
22
24
  end