diff --git a/lib/netsuite/records/inventory_item.rb b/lib/netsuite/records/inventory_item.rb index ef91feaff..2b0969887 100644 --- a/lib/netsuite/records/inventory_item.rb +++ b/lib/netsuite/records/inventory_item.rb @@ -45,6 +45,66 @@ class InventoryItem :total_value, :track_landed_cost, :transfer_price, :upc_code, :url_component, :use_bins, :use_marginal_rates, :vendor_name, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :weight, :weight_unit, :weight_units + # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_2/schema/search/itemsearchrowbasic.html?mode=package + search_only_fields :acc_book_rev_rec_forecast_rule, :accounting_book, + :accounting_book_amortization, :accounting_book_create_plans_on, + :accounting_book_rev_rec_rule, :accounting_book_rev_rec_schedule, + :allowed_shipping_method, :atp_lead_time, :atp_method, :base_price, + :bin_number, :bin_on_hand_avail, :bin_on_hand_count, :bom_quantity, + :build_entire_assembly, :build_time, :buy_it_now_price, :category, + :category_preferred, :component_yield, :correlated_item, + :correlated_item_correlation, :correlated_item_count, + :correlated_item_lift, :correlated_item_purchase_rate, + :cost_accounting_status, :created, :create_job, + :cust_return_variance_account, :date_viewed, :days_before_expiration, + :default_shipping_method, :deferred_expense_account, + :departmentnohierarchy, :display_ine_bay_store, :e_bay_item_description, + :e_bay_item_subtitle, :e_bay_item_title, :ebay_relisting_option, + :effective_bom_control, :effective_date, :effective_revision, + :end_auctions_when_out_of_stock, :feed_description, :feed_name, + :froogle_product_feed, :fx_cost, :generate_accruals, + :gift_cert_auth_code, :gift_cert_email, :gift_cert_expiration_date, + :gift_cert_from, :gift_cert_message, :gift_cert_original_amount, + :gift_cert_recipient, :hierarchy_node, :hierarchy_version, :hits, + :image_url, :interco_expense_account, :inventory_location, + :is_available, :is_fulfillable, :is_lot_item, :is_serial_item, + :is_special_work_order_item, :is_vsoe_bundle, :is_wip, :item_url, + :last_quantity_available_change, :liability_account, :listing_duration, + :location_allow_store_pickup, :location_atp_lead_time, + :location_average_cost, :location_bin_quantity_available, + :location_build_time, :location_cost, :location_cost_accounting_status, + :location_default_return_cost, :location_demand_source, + :location_demand_time_fence, :location_fixed_lot_size, + :location_inventory_cost_template, :location_invt_classification, + :location_invt_count_interval, :location_last_invt_count_date, + :location_lead_time, :location_next_invt_count_date, + :location_periodic_lot_size_days, :location_periodic_lot_size_type, + :location_preferred_stock_level, :location_qty_avail_for_store_pickup, + :location_quantity_available, :location_quantity_back_ordered, + :location_quantity_committed, :location_quantity_in_transit, + :location_quantity_on_hand, :location_quantity_on_order, + :location_re_order_point, :location_reschedule_in_days, + :location_reschedule_out_days, :location_safety_stock_level, + :location_store_pickup_buffer_stock, :location_supply_lot_sizing_method, + :location_supply_time_fence, :location_supply_type, + :location_total_value, :loc_backward_consumption_days, + :loc_forward_consumption_days, :manufacturing_charge_item, :member_item, + :member_quantity, :modified, :moss_applies, :nextag_product_feed, + :num_active_listings, :number_allowed_downloads, :num_currently_listed, + :obsolete_date, :obsolete_revision, :online_customer_price, + :online_price, :other_prices, :other_vendor, :overhead_type, + :preferred_bin, :primary_category, :prod_price_variance_acct, + :prod_qty_variance_acct, :purchase_unit, :reserve_price, + :revenue_recognition_rule, :same_as_primary_book_amortization, + :same_as_primary_book_rev_rec, :scrap_acct, :sell_on_ebay, + :serial_number, :serial_number_location, :shipping_carrier, + :shipping_rate, :shopping_product_feed, :shopzilla_product_feed, + :soft_descriptor, :starting_price, :subsidiary, :sub_type, + :thumb_nail_url, :type, :unbuild_variance_account, :use_component_yield, + :vendor_code, :vendor_cost, :vendor_cost_entered, + :vendor_price_currency, :vendor_schedule, :vend_return_variance_account, + :web_site, :wip_acct, :wip_variance_acct, :yahoo_product_feed + record_refs :alternate_demand_source_item, :asset_account, :bill_exch_rate_variance_acct, :bill_price_variance_acct, :bill_qty_variance_acct, :billing_schedule, :cogs_account, :cost_category, :custom_form, :deferred_revenue_account, :demand_source, :department, :expense_account, :gain_loss_account, :income_account, :issue_product, :klass, :location, diff --git a/lib/netsuite/records/invoice.rb b/lib/netsuite/records/invoice.rb index 60f25aba5..7ef656e32 100644 --- a/lib/netsuite/records/invoice.rb +++ b/lib/netsuite/records/invoice.rb @@ -42,6 +42,99 @@ class Invoice read_only_fields :sub_total, :discount_total, :total, :recognized_revenue, :amount_remaining, :amount_paid, :amount, :alt_shipping_cost, :gift_cert_applied, :handling_cost, :alt_handling_cost + # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_2/schema/search/transactionsearchrowbasic.html?mode=package + search_only_fields :abbrev, :account_type, :acct_corp_card_exp, + :actual_production_end_date, :actual_production_start_date, + :actual_ship_date, :alt_sales_amount, :alt_sales_net_amount, :amount, + :amount_unbilled, :applied_to_foreign_amount, + :applied_to_is_fx_variance, :applied_to_link_amount, + :applied_to_link_type, :applied_to_transaction, + :applying_foreign_amount, :applying_is_fx_variance, + :applying_link_amount, :applying_link_type, :applying_transaction, + :auth_code, :auto_calculate_lag, :avs_street_match, :avs_zip_match, + :billable, :bill_address, :bill_address1, :bill_address2, + :bill_address3, :bill_addressee, :bill_attention, :bill_city, + :bill_country, :bill_country_code, :billed_date, :billing_amount, + :billing_transaction, :bill_phone, :bill_state, :bill_variance_status, + :bill_zip, :bin_number, :bin_number_quantity, :bom_quantity, + :build_entire_assembly, :build_variance, :built, + :can_have_stackable_promotions, :catch_up_period, :cc_customer_code, + :cc_exp_date, :cc_holder_name, :cc_number, :cc_street, :cc_zip_code, + :cleared, :closed, :close_date, :cogs_amount, + :commission_effective_date, :commit, :component_yield, + :confirmation_number, :contribution, :contribution_primary, + :cost_component_amount, :cost_component_category, :cost_component_item, + :cost_component_quantity, :cost_component_standard_cost, :cost_estimate, + :cost_estimate_rate, :cost_estimate_type, :created_by, :credit_amount, + :csc_match, :custom_gl, :cust_type, :date_created, :days_open, + :days_overdue, :debit_amount, :defer_rev_rec, :deposit_date, + :deposit_transaction, :doc_unit, :dr_account, :effective_rate, + :entity_status, :est_gross_profit_pct, :exclude_from_rate_request, + :expected_close_date, :expected_receipt_date, :expense_category, + :expense_date, :firmed, :forecast_type, :fulfilling_transaction, + :fx_account, :fx_amount, :fx_cost_estimate, :fx_cost_estimate_rate, + :fx_est_gross_profit, :fx_tran_cost_estimate, :fx_vsoe_allocation, + :fx_vsoe_amount, :fx_vsoe_price, :gco_availabel_to_charge, + :gco_available_to_refund, :gco_avs_street_match, :gco_avs_zip_match, + :gco_buyer_account_age, :gco_buyer_ip, :gco_charge_amount, + :gco_chargeback_amount, :gco_confirmed_charged_total, + :gco_confirmed_refunded_total, :gco_creditcard_number, :gco_csc_match, + :gco_financial_state, :gco_fulfillment_state, :gco_order_id, + :gco_order_total, :gco_promotion_amount, :gco_promotion_name, + :gco_refund_amount, :gco_shipping_total, :gco_state_changed_detail, + :gift_cert, :gross_amount, :include_in_forecast, :incoterm, + :interco_status, :interco_transaction, :inventory_location, + :inventory_subsidiary, :in_vsoe_bundle, :is_allocation, :is_backflush, + :is_gco_chargeback, :is_gco_charge_confirmed, + :is_gco_payment_guaranteed, :is_gco_refund_confirmed, + :is_inside_delivery, :is_inside_pickup, :is_intercompany_adjustment, + :is_in_transit_payment, :is_multi_ship_to, :is_reversal, + :is_rev_rec_transaction, :is_scrap, :is_ship_address, + :is_transfer_price_costing, :is_wip, :item, :item_fulfillment_choice, + :item_revision, :landed_cost_per_line, :line, :line_sequence_number, + :line_unique_key, :location_auto_assigned, :main_line, :main_name, + :manufacturing_routing, :match_bill_to_receipt, :memo_main, :memorized, + :merchant_account, :multi_subsidiary, :net_amount, :net_amount_no_tax, + :next_bill_date, :no_auto_assign_location, :non_reimbursable, + :one_time_total, :options, :order_allocation_strategy, :order_priority, + :originator, :other_ref_num, :overhead_parent_item, + :override_installments, :package_count, :paid_amount, :paid_transaction, + :partner_contribution, :partner_role, :partner_team_member, + :paying_amount, :paying_transaction, :payment_approved, + :payment_event_date, :payment_event_hold_reason, + :payment_event_purchase_card_used, :payment_event_purchase_data_sent, + :payment_event_result, :payment_event_type, :payment_hold, + :payment_method, :payment_option, :pay_pal_pending, :pay_pal_status, + :pay_pal_tran_id, :payroll_batch, :pn_ref_num, :po_rate, :posting, + :price_level, :print, :probability, :projected_amount, :project_task, + :purchase_order, :quantity, :quantity_billed, :quantity_committed, + :quantity_packed, :quantity_picked, :quantity_rev_committed, + :quantity_ship_recv, :quantity_uom, :rate, + :realized_gain_posting_transaction, :recur_annually_total, + :recur_monthly_total, :recur_quarterly_total, :recur_weekly_total, + :ref_number, :requested_date, :rev_commit_status, + :rev_committing_transaction, :reversal_date, :reversal_number, + :rg_account, :rg_amount, :sales_order, :sales_team_member, + :sales_team_role, :scheduling_method, :serial_number, + :serial_number_cost, :serial_number_cost_adjustment, + :serial_number_quantity, :serial_numbers, :ship_address, :ship_address1, + :ship_address2, :ship_address3, :ship_addressee, :ship_attention, + :ship_carrier, :ship_city, :ship_complete, :ship_country, + :ship_country_code, :ship_group, :ship_phone, :shipping_amount, + :ship_recv_status_line, :ship_state, :ship_to, :ship_zip, + :signed_amount, :subscription, :subscription_line, :tax_amount, + :tax_code, :tax_line, :tax_period, :term_in_months, :terms_of_sale, + :title, :to_subsidiary, :tran_est_gross_profit, + :tran_fx_est_gross_profit, :transaction_discount, + :transaction_line_type, :transaction_number, :transfer_location, + :transfer_order_item_line, :transfer_order_quantity_committed, + :transfer_order_quantity_packed, :transfer_order_quantity_picked, + :transfer_order_quantity_received, :transfer_order_quantity_shipped, + :type, :unit, :unit_cost_override, :vend_type, :visible_to_customer, + :vsoe_allocation, :vsoe_amount, :vsoe_deferral, :vsoe_delivered, + :vsoe_permit_discount, :vsoe_price, :web_site + # TODO: Add record_type, conflicts with Support::Records#record_type, returns "invoice" versus "tranSales:Invoice" + record_refs :account, :bill_address_list, :custom_form, :department, :entity, :klass, :partner, :posting_period, :ship_address_list, :terms, :location, :sales_rep, :tax_item, :created_from, :ship_method, :lead_source, :promo_code, :subsidiary, :currency, :approval_status, :job, :discount_item diff --git a/lib/netsuite/support/fields.rb b/lib/netsuite/support/fields.rb index 14e3d7fc1..94d529e1d 100644 --- a/lib/netsuite/support/fields.rb +++ b/lib/netsuite/support/fields.rb @@ -60,6 +60,22 @@ def read_only_field(name) read_only_fields << name_sym field name end + + def search_only_fields(*args) + if args.empty? + @search_only_fields ||= Set.new + else + args.each do |arg| + search_only_field arg + end + end + end + + def search_only_field(name) + name_sym = name.to_sym + search_only_fields << name_sym + field name + end end end diff --git a/lib/netsuite/support/records.rb b/lib/netsuite/support/records.rb index 74f3aa9d2..447755f55 100644 --- a/lib/netsuite/support/records.rb +++ b/lib/netsuite/support/records.rb @@ -5,7 +5,7 @@ module Records include Namespaces::PlatformCore def to_record - attributes.reject { |k,v| self.class.read_only_fields.include?(k) }.inject({}) do |hash, (k,v)| + attributes.reject { |k,v| self.class.read_only_fields.include?(k) || self.class.search_only_fields.include?(k) }.inject({}) do |hash, (k,v)| kname = "#{record_namespace}:" kname += k == :klass ? 'class' : k.to_s.lower_camelcase diff --git a/spec/netsuite/actions/search_spec.rb b/spec/netsuite/actions/search_spec.rb index b6eff64bc..b8babbfbd 100644 --- a/spec/netsuite/actions/search_spec.rb +++ b/spec/netsuite/actions/search_spec.rb @@ -175,6 +175,24 @@ expect(search.results.first.custom_field_list.custitem_apcategoryforsales.value.internal_id).to eq('4') expect(search.results.last.email).to eq('alessawesome@gmail.com') end + + it "should handle an ID search with basic search only field result columns" do + response = File.read('spec/support/fixtures/search/saved_search_item.xml') + savon.expects(:search) + .with(message: { + "searchRecord"=>{ + "@xsi:type" =>"listAcct:ItemSearchAdvanced", + "@savedSearchId" =>42, + :content! =>{"listAcct:criteria"=>{}}, + } + }).returns(response) + + search = NetSuite::Records::InventoryItem.search(saved: 42) + + expect(search.results.first.location_quantity_available).to eq('3307.0') + expect(search.results.first.location_re_order_point).to eq('2565.0') + expect(search.results.first.location_quantity_on_order).to eq('40000.0') + end end context "advanced search" do diff --git a/spec/netsuite/records/inventory_item_spec.rb b/spec/netsuite/records/inventory_item_spec.rb index 32c643f67..f44e3a256 100644 --- a/spec/netsuite/records/inventory_item_spec.rb +++ b/spec/netsuite/records/inventory_item_spec.rb @@ -31,6 +31,70 @@ end end + it 'has all the right search_only_fields' do + [ + :acc_book_rev_rec_forecast_rule, :accounting_book, + :accounting_book_amortization, :accounting_book_create_plans_on, + :accounting_book_rev_rec_rule, :accounting_book_rev_rec_schedule, + :allowed_shipping_method, :atp_lead_time, :atp_method, :base_price, + :bin_number, :bin_on_hand_avail, :bin_on_hand_count, :bom_quantity, + :build_entire_assembly, :build_time, :buy_it_now_price, :category, + :category_preferred, :component_yield, :correlated_item, + :correlated_item_correlation, :correlated_item_count, + :correlated_item_lift, :correlated_item_purchase_rate, + :cost_accounting_status, :created, :create_job, + :cust_return_variance_account, :date_viewed, :days_before_expiration, + :default_shipping_method, :deferred_expense_account, + :departmentnohierarchy, :display_ine_bay_store, :e_bay_item_description, + :e_bay_item_subtitle, :e_bay_item_title, :ebay_relisting_option, + :effective_bom_control, :effective_date, :effective_revision, + :end_auctions_when_out_of_stock, :feed_description, :feed_name, + :froogle_product_feed, :fx_cost, :generate_accruals, :gift_cert_auth_code, + :gift_cert_email, :gift_cert_expiration_date, :gift_cert_from, + :gift_cert_message, :gift_cert_original_amount, :gift_cert_recipient, + :hierarchy_node, :hierarchy_version, :hits, :image_url, + :interco_expense_account, :inventory_location, :is_available, + :is_fulfillable, :is_lot_item, :is_serial_item, + :is_special_work_order_item, :is_vsoe_bundle, :is_wip, :item_url, + :last_quantity_available_change, :liability_account, :listing_duration, + :location_allow_store_pickup, :location_atp_lead_time, + :location_average_cost, :location_bin_quantity_available, + :location_build_time, :location_cost, :location_cost_accounting_status, + :location_default_return_cost, :location_demand_source, + :location_demand_time_fence, :location_fixed_lot_size, + :location_inventory_cost_template, :location_invt_classification, + :location_invt_count_interval, :location_last_invt_count_date, + :location_lead_time, :location_next_invt_count_date, + :location_periodic_lot_size_days, :location_periodic_lot_size_type, + :location_preferred_stock_level, :location_qty_avail_for_store_pickup, + :location_quantity_available, :location_quantity_back_ordered, + :location_quantity_committed, :location_quantity_in_transit, + :location_quantity_on_hand, :location_quantity_on_order, + :location_re_order_point, :location_reschedule_in_days, + :location_reschedule_out_days, :location_safety_stock_level, + :location_store_pickup_buffer_stock, :location_supply_lot_sizing_method, + :location_supply_time_fence, :location_supply_type, :location_total_value, + :loc_backward_consumption_days, :loc_forward_consumption_days, + :manufacturing_charge_item, :member_item, :member_quantity, :modified, + :moss_applies, :nextag_product_feed, :num_active_listings, + :number_allowed_downloads, :num_currently_listed, :obsolete_date, + :obsolete_revision, :online_customer_price, :online_price, :other_prices, + :other_vendor, :overhead_type, :preferred_bin, :primary_category, + :prod_price_variance_acct, :prod_qty_variance_acct, :purchase_unit, + :reserve_price, :revenue_recognition_rule, + :same_as_primary_book_amortization, :same_as_primary_book_rev_rec, + :scrap_acct, :sell_on_ebay, :serial_number, :serial_number_location, + :shipping_carrier, :shipping_rate, :shopping_product_feed, + :shopzilla_product_feed, :soft_descriptor, :starting_price, :subsidiary, + :sub_type, :thumb_nail_url, :type, :unbuild_variance_account, + :use_component_yield, :vendor_code, :vendor_cost, :vendor_cost_entered, + :vendor_price_currency, :vendor_schedule, :vend_return_variance_account, + :web_site, :wip_acct, :wip_variance_acct, :yahoo_product_feed, + ].each do |field| + expect(NetSuite::Records::InventoryItem).to have_search_only_field(field) + end + end + it 'has all the right record refs' do [ :alternate_demand_source_item, :asset_account, :bill_exch_rate_variance_acct, :bill_price_variance_acct, :bill_qty_variance_acct, :billing_schedule, :cogs_account, :cost_category, :custom_form, :deferred_revenue_account, :demand_source, :department, :expense_account, :gain_loss_account, :income_account, :issue_product, :klass, :location, :parent, :preferred_location, :pricing_group, :purchase_price_variance_acct, :purchase_tax_code, :purchase_unit, :quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :ship_package, :soft_descriptor, :stock_unit, :store_display_image, :store_display_thumbnail, :store_item_template, :supply_lot_sizing_method, :supply_replenishment_method, :supply_type, :tax_schedule, :units_type, :vendor @@ -215,6 +279,7 @@ before do item.cost = 100 item.is_inactive = false + item.location_quantity_available = '1.0' # Search only, excluded end it 'can represent itself as a SOAP record' do record = { diff --git a/spec/netsuite/records/invoice_spec.rb b/spec/netsuite/records/invoice_spec.rb index cae6262e9..4b654ec38 100644 --- a/spec/netsuite/records/invoice_spec.rb +++ b/spec/netsuite/records/invoice_spec.rb @@ -41,6 +41,99 @@ end end + it 'has all the right search_only_fields' do + [ + :abbrev, :account_type, :acct_corp_card_exp, :actual_production_end_date, + :actual_production_start_date, :actual_ship_date, :alt_sales_amount, + :alt_sales_net_amount, :amount, :amount_unbilled, + :applied_to_foreign_amount, :applied_to_is_fx_variance, + :applied_to_link_amount, :applied_to_link_type, :applied_to_transaction, + :applying_foreign_amount, :applying_is_fx_variance, :applying_link_amount, + :applying_link_type, :applying_transaction, :auth_code, + :auto_calculate_lag, :avs_street_match, :avs_zip_match, :billable, + :bill_address, :bill_address1, :bill_address2, :bill_address3, + :bill_addressee, :bill_attention, :bill_city, :bill_country, + :bill_country_code, :billed_date, :billing_amount, :billing_transaction, + :bill_phone, :bill_state, :bill_variance_status, :bill_zip, :bin_number, + :bin_number_quantity, :bom_quantity, :build_entire_assembly, + :build_variance, :built, :can_have_stackable_promotions, :catch_up_period, + :cc_customer_code, :cc_exp_date, :cc_holder_name, :cc_number, :cc_street, + :cc_zip_code, :cleared, :closed, :close_date, :cogs_amount, + :commission_effective_date, :commit, :component_yield, + :confirmation_number, :contribution, :contribution_primary, + :cost_component_amount, :cost_component_category, :cost_component_item, + :cost_component_quantity, :cost_component_standard_cost, :cost_estimate, + :cost_estimate_rate, :cost_estimate_type, :created_by, :credit_amount, + :csc_match, :custom_gl, :cust_type, :date_created, :days_open, + :days_overdue, :debit_amount, :defer_rev_rec, :deposit_date, + :deposit_transaction, :doc_unit, :dr_account, :effective_rate, + :entity_status, :est_gross_profit_pct, :exclude_from_rate_request, + :expected_close_date, :expected_receipt_date, :expense_category, + :expense_date, :firmed, :forecast_type, :fulfilling_transaction, + :fx_account, :fx_amount, :fx_cost_estimate, :fx_cost_estimate_rate, + :fx_est_gross_profit, :fx_tran_cost_estimate, :fx_vsoe_allocation, + :fx_vsoe_amount, :fx_vsoe_price, :gco_availabel_to_charge, + :gco_available_to_refund, :gco_avs_street_match, :gco_avs_zip_match, + :gco_buyer_account_age, :gco_buyer_ip, :gco_charge_amount, + :gco_chargeback_amount, :gco_confirmed_charged_total, + :gco_confirmed_refunded_total, :gco_creditcard_number, :gco_csc_match, + :gco_financial_state, :gco_fulfillment_state, :gco_order_id, + :gco_order_total, :gco_promotion_amount, :gco_promotion_name, + :gco_refund_amount, :gco_shipping_total, :gco_state_changed_detail, + :gift_cert, :gross_amount, :include_in_forecast, :incoterm, + :interco_status, :interco_transaction, :inventory_location, + :inventory_subsidiary, :in_vsoe_bundle, :is_allocation, :is_backflush, + :is_gco_chargeback, :is_gco_charge_confirmed, :is_gco_payment_guaranteed, + :is_gco_refund_confirmed, :is_inside_delivery, :is_inside_pickup, + :is_intercompany_adjustment, :is_in_transit_payment, :is_multi_ship_to, + :is_reversal, :is_rev_rec_transaction, :is_scrap, :is_ship_address, + :is_transfer_price_costing, :is_wip, :item, :item_fulfillment_choice, + :item_revision, :landed_cost_per_line, :line, :line_sequence_number, + :line_unique_key, :location_auto_assigned, :main_line, :main_name, + :manufacturing_routing, :match_bill_to_receipt, :memo_main, :memorized, + :merchant_account, :multi_subsidiary, :net_amount, :net_amount_no_tax, + :next_bill_date, :no_auto_assign_location, :non_reimbursable, + :one_time_total, :options, :order_allocation_strategy, :order_priority, + :originator, :other_ref_num, :overhead_parent_item, + :override_installments, :package_count, :paid_amount, :paid_transaction, + :partner_contribution, :partner_role, :partner_team_member, + :paying_amount, :paying_transaction, :payment_approved, + :payment_event_date, :payment_event_hold_reason, + :payment_event_purchase_card_used, :payment_event_purchase_data_sent, + :payment_event_result, :payment_event_type, :payment_hold, + :payment_method, :payment_option, :pay_pal_pending, :pay_pal_status, + :pay_pal_tran_id, :payroll_batch, :pn_ref_num, :po_rate, :posting, + :price_level, :print, :probability, :projected_amount, :project_task, + :purchase_order, :quantity, :quantity_billed, :quantity_committed, + :quantity_packed, :quantity_picked, :quantity_rev_committed, + :quantity_ship_recv, :quantity_uom, :rate, + :realized_gain_posting_transaction, :recur_annually_total, + :recur_monthly_total, :recur_quarterly_total, :recur_weekly_total, + :ref_number, :requested_date, :rev_commit_status, + :rev_committing_transaction, :reversal_date, :reversal_number, + :rg_account, :rg_amount, :sales_order, :sales_team_member, + :sales_team_role, :scheduling_method, :serial_number, :serial_number_cost, + :serial_number_cost_adjustment, :serial_number_quantity, :serial_numbers, + :ship_address, :ship_address1, :ship_address2, :ship_address3, + :ship_addressee, :ship_attention, :ship_carrier, :ship_city, + :ship_complete, :ship_country, :ship_country_code, :ship_group, + :ship_phone, :shipping_amount, :ship_recv_status_line, :ship_state, + :ship_to, :ship_zip, :signed_amount, :subscription, :subscription_line, + :tax_amount, :tax_code, :tax_line, :tax_period, :term_in_months, + :terms_of_sale, :title, :to_subsidiary, :tran_est_gross_profit, + :tran_fx_est_gross_profit, :transaction_discount, :transaction_line_type, + :transaction_number, :transfer_location, :transfer_order_item_line, + :transfer_order_quantity_committed, :transfer_order_quantity_packed, + :transfer_order_quantity_picked, :transfer_order_quantity_received, + :transfer_order_quantity_shipped, :type, :unit, :unit_cost_override, + :vend_type, :visible_to_customer, :vsoe_allocation, :vsoe_amount, + :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, + :web_site, + ].each do |field| + expect(NetSuite::Records::Invoice).to have_search_only_field(field) + end + end + it 'has the right record_refs' do [ :account, :bill_address_list, :job, :custom_form, :department, :entity, :klass, :posting_period, :ship_address_list, :terms, @@ -329,6 +422,7 @@ before do invoice.email = 'something@example.com' invoice.tran_id = '4' + invoice.close_date = '2021-08-04' # Search only, excluded end it 'can represent itself as a SOAP record' do record = { diff --git a/spec/support/fixtures/search/saved_search_item.xml b/spec/support/fixtures/search/saved_search_item.xml new file mode 100644 index 000000000..78a14968d --- /dev/null +++ b/spec/support/fixtures/search/saved_search_item.xml @@ -0,0 +1,55 @@ + + + + WEBSERVICES_3603333_SB1_0320201916835580962038419462_2ce0aa2 + + + + + + + 49 + 1000 + 1 + 1 + WEBSERVICES_3603333_SB1_0320201916835580962038419462_2ce0aa2 + + + + + + Business Unit + + + 9781945179747 + SKU + + + 3307.0 + Qty - Available + + + 40000.0 + Qty - On Order + + + 2565.0 + Qty - Reorder Point + + + + + Product Line + + + + Reorder Status + + + + + + + + + diff --git a/spec/support/search_only_field_matcher.rb b/spec/support/search_only_field_matcher.rb new file mode 100644 index 000000000..4d6b8fb10 --- /dev/null +++ b/spec/support/search_only_field_matcher.rb @@ -0,0 +1,7 @@ +RSpec::Matchers.define :have_search_only_field do |attribute| + + match do |model| + expect(model.search_only_fields.include?(attribute)).to be_truthy + end + +end