Skip to content

Commit

Permalink
Update ServiceResaleItem fields/record_refs for 2021.2 (#500)
Browse files Browse the repository at this point in the history
A couple were missing for my use case, so I updated them based on 2021.2

The following "fields" were removed as "fields" since they require
specialized record classes that haven't been implemented yet:
- cost_estimate_type
- item_options_list
- matrix_type
- out_of_stock_behavior
- overall_quantity_pricing_type
- presentation_item_list
- site_category_list
- sitemap_priority
- translations_list
- vsoe_deferral
- vsoe_permit_discount
- vsoe_sop_group
I arbitrarily went back 5 years (to version 2016.1) and these were all
using specialized types back then, so this doesn't appear to have been a
recent change on the NetSuite side of things that might affect users of
this gem.
  • Loading branch information
cgunther committed Dec 14, 2021
1 parent 75e5ae2 commit 5c1d56e
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 37 deletions.
2 changes: 1 addition & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Unreleased

### Added
*
* Update ServiceResaleItem record fields/record refs for 2021.2. `cost_estimate_type`, `item_options_list`, `matrix_type`, `out_of_stock_behavior`, `overall_quantity_pricing_type`, `presentation_item_list`, `site_category_list`, `sitemap_priority`, `translations_list`, `vsoe_deferral`, `vsoe_permit_discount`, `vsoe_sop_group` were all removed as fields as the are not simple fields, they require special classes. (#500)

### Fixed
*
Expand Down
142 changes: 123 additions & 19 deletions lib/netsuite/records/service_resale_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,132 @@ class ServiceResaleItem

actions :get, :get_list, :add, :update, :delete, :upsert, :search

fields :available_to_partners, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date,
:display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description,
:include_children, :is_donation_item, :is_fulfillable, :is_gco_compliant, :is_inactive, :is_online, :is_taxable,
:item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html,
:minimum_quantity, :minimum_quantity_units, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
:out_of_stock_message, :overall_quantity_pricing_type, :page_title, :presentation_item_list, :prices_include_tax,
:rate, :related_items_description, :sales_description, :search_keywords,
:show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description,
:store_description, :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component,
:use_marginal_rates, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :vsoe_sop_group

# item_task_templates_list
# billing_rates_matrix -- RecordRef, via listAcct::ItemOptionsList

record_refs :billing_schedule, :cost_category, :custom_form, :deferred_revenue_account, :department, :income_account,
:issue_product, :item_options_list, :klass, :location, :parent, :pricing_group, :purchase_tax_code,
:quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :store_display_image,
:store_display_thumbnail, :store_item_template, :tax_schedule, :units_type
fields :amortization_period,
:available_to_partners,
:contingent_revenue_handling,
:cost,
:cost_estimate,
:cost_estimate_units,
:cost_units,
:created_date,
:create_job,
:currency,
:defer_rev_rec,
:direct_revenue_posting,
:display_name,
:dont_show_price,
:enforce_min_qty_internally,
:exclude_from_sitemap,
:featured_description,
:generate_accruals,
:include_children,
:is_donation_item,
:is_fulfillable,
:is_gco_compliant,
:is_inactive,
:is_online,
:is_taxable,
:item_id,
:last_modified_date,
:manufacturing_charge_item,
:matrix_item_name_template,
:max_donation_amount,
:maximum_quantity,
:meta_tag_html,
:minimum_quantity,
:minimum_quantity_units,
:no_price_message,
:offer_support,
:on_special,
:out_of_stock_message,
:page_title,
:prices_include_tax,
:purchase_description,
:purchase_order_amount,
:purchase_order_quantity,
:purchase_order_quantity_diff,
:rate,
:receipt_amount,
:receipt_quantity,
:receipt_quantity_diff,
:related_items_description,
:residual,
:sales_description,
:search_keywords,
:show_default_donation_amount,
:soft_descriptor,
:specials_description,
:store_description,
:store_detailed_description,
:store_display_name,
:upc_code,
:url_component,
:use_marginal_rates,
:vendor_name,
:vsoe_delivered,
:vsoe_price

record_refs :amortization_template,
:bill_exch_rate_variance_acct,
:billing_schedule,
:bill_price_variance_acct,
:bill_qty_variance_acct,
:klass,
:consumption_unit,
:cost_category,
:create_revenue_plans_on,
:custom_form,
:deferral_account,
:deferred_revenue_account,
:department,
:expense_account,
:income_account,
:interco_def_rev_account,
:interco_expense_account,
:interco_income_account,
:issue_product,
:item_revenue_category,
:location,
:parent,
:pricing_group,
:purchase_tax_code,
:purchase_unit,
:quantity_pricing_schedule,
:revenue_allocation_group,
:revenue_recognition_rule,
:rev_rec_forecast_rule,
:rev_reclass_f_x_account,
:rev_rec_schedule,
:sales_tax_code,
:sale_unit,
:store_display_image,
:store_display_thumbnail,
:store_item_template,
:tax_schedule,
:units_type,
:vendor

field :pricing_matrix, PricingMatrix
field :custom_field_list, CustomFieldList
field :item_vendor_list, ItemVendorList
field :matrix_option_list, MatrixOptionList
field :pricing_matrix, PricingMatrix
field :subsidiary_list, RecordRefList
# TODO: field :accounting_book_detail_list, ItemAccountingBookDetailList
# TODO: field :billing_rates_matrix, BillingRatesMatrix
# TODO: field :cost_estimate_type, ItemCostEstimateType
# TODO: field :item_options_list, ItemOptionsList
# TODO: field :item_task_templates_list, ServiceItemTaskTemplatesList
# TODO: field :hierarchy_versions_list, ServiceResaleItemHierarchyVersionsList
# TODO: field :matrix_type, ItemMatrixType
# TODO: field :out_of_stock_behavior, ItemOutOfStockBehavior
# TODO: field :overall_quantity_pricing_type, ItemOverallQuantityPricingType
# TODO: field :presentation_item_list, PresentationItemList
# TODO: field :site_category_list, SiteCategoryList
# TODO: field :sitemap_priority, SitemapPriority
# TODO: field :translations_list, TranslationList
# TODO: field :vsoe_deferral, VsoeDeferral
# TODO: field :vsoe_permit_discount, VsoePermitDiscount
# TODO: field :vsoe_sop_group, VsoeSopGroup

attr_reader :internal_id
attr_accessor :external_id
Expand Down
131 changes: 114 additions & 17 deletions spec/netsuite/records/service_resale_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,128 @@

it 'has the right fields' do
[
:available_to_partners, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date,
:display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description,
:include_children, :is_donation_item, :is_fulfillable, :is_gco_compliant, :is_inactive, :is_online, :is_taxable,
:item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html,
:minimum_quantity, :minimum_quantity_units, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
:out_of_stock_message, :overall_quantity_pricing_type, :page_title, :presentation_item_list, :prices_include_tax,
:show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description,
:store_description, :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component,
:use_marginal_rates, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :vsoe_sop_group
:amortization_period,
:available_to_partners,
:contingent_revenue_handling,
:cost,
:cost_estimate,
:cost_estimate_units,
:cost_units,
:created_date,
:create_job,
:currency,
:defer_rev_rec,
:direct_revenue_posting,
:display_name,
:dont_show_price,
:enforce_min_qty_internally,
:exclude_from_sitemap,
:featured_description,
:generate_accruals,
:include_children,
:is_donation_item,
:is_fulfillable,
:is_gco_compliant,
:is_inactive,
:is_online,
:is_taxable,
:item_id,
:last_modified_date,
:manufacturing_charge_item,
:matrix_item_name_template,
:max_donation_amount,
:maximum_quantity,
:meta_tag_html,
:minimum_quantity,
:minimum_quantity_units,
:no_price_message,
:offer_support,
:on_special,
:out_of_stock_message,
:page_title,
:prices_include_tax,
:purchase_description,
:purchase_order_amount,
:purchase_order_quantity,
:purchase_order_quantity_diff,
:rate,
:receipt_amount,
:receipt_quantity,
:receipt_quantity_diff,
:related_items_description,
:residual,
:sales_description,
:search_keywords,
:show_default_donation_amount,
:soft_descriptor,
:specials_description,
:store_description,
:store_detailed_description,
:store_display_name,
:upc_code,
:url_component,
:use_marginal_rates,
:vendor_name,
:vsoe_delivered,
:vsoe_price,
].each do |field|
expect(item).to have_field(field)
end
end

# TODO there is a probably a more robust way to test this
expect(item.custom_field_list.class).to eq(NetSuite::Records::CustomFieldList)
expect(item.pricing_matrix.class).to eq(NetSuite::Records::PricingMatrix)
expect(item.subsidiary_list.class).to eq(NetSuite::Records::RecordRefList)
it 'has all the right fields with specific classes' do
{
custom_field_list: NetSuite::Records::CustomFieldList,
item_vendor_list: NetSuite::Records::ItemVendorList,
matrix_option_list: NetSuite::Records::MatrixOptionList,
pricing_matrix: NetSuite::Records::PricingMatrix,
subsidiary_list: NetSuite::Records::RecordRefList,
}.each do |field, klass|
expect(item).to have_field(field, klass)
end
end

it 'has the right record_refs' do
[
:billing_schedule, :cost_category, :custom_form, :deferred_revenue_account, :department, :income_account,
:issue_product, :item_options_list, :klass, :location, :parent, :pricing_group, :purchase_tax_code,
:quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :store_display_image,
:store_display_thumbnail, :store_item_template, :tax_schedule, :units_type
:amortization_template,
:bill_exch_rate_variance_acct,
:billing_schedule,
:bill_price_variance_acct,
:bill_qty_variance_acct,
:klass,
:consumption_unit,
:cost_category,
:create_revenue_plans_on,
:custom_form,
:deferral_account,
:deferred_revenue_account,
:department,
:expense_account,
:income_account,
:interco_def_rev_account,
:interco_expense_account,
:interco_income_account,
:issue_product,
:item_revenue_category,
:location,
:parent,
:pricing_group,
:purchase_tax_code,
:purchase_unit,
:quantity_pricing_schedule,
:revenue_allocation_group,
:revenue_recognition_rule,
:rev_rec_forecast_rule,
:rev_reclass_f_x_account,
:rev_rec_schedule,
:sales_tax_code,
:sale_unit,
:store_display_image,
:store_display_thumbnail,
:store_item_template,
:tax_schedule,
:units_type,
:vendor,
].each do |record_ref|
expect(item).to have_record_ref(record_ref)
end
Expand Down

0 comments on commit 5c1d56e

Please sign in to comment.