Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update NonInventoryResaleItem fields/record_refs for 2021.2 #508

Merged
merged 1 commit into from
Dec 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Update ItemVendor record fields/record refs for 2021.1. `vendor` is now a record_ref instead of a field. (#505)
* Update InventoryItem record fields/record refs for 2021.2. `member_list` was removed as a field as it doesn't belong to InventoryItem. (#506)
* Update LotNumberedInventoryItem record fields/record refs for 2021.2. (#507)
* Update NonInventoryResaleItem record fields/record refs for 2021.2. `item_options_list`, `presentation_item_list`, `product_feed_list`, `site_category_list`, `translations_list` were all removed as fields as the are not simple fields, they require special classes. (#508)

### Fixed
* Fix "undefined method `[]` for #<Nori::StringIOFile>" when adding File (#495)
Expand Down
176 changes: 156 additions & 20 deletions lib/netsuite/records/non_inventory_resale_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,168 @@ class NonInventoryResaleItem

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

fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture,
:created_date, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap,
:featured_description, :handling_cost, :handling_cost_units, :include_children, :is_donation_item, :is_fulfillable,
:is_gco_compliant, :is_inactive, :is_online, :is_taxable, :item_id, :last_modified_date, :manufacturer,
:manufacturer_addr1, :manufacturer_city, :manufacturer_state, :manufacturer_tariff, :manufacturer_tax_id,
:manufacturer_zip, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity,
:minimum_quantity_units, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support,
:on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title,
:preference_criterion, :presentation_item_list, :prices_include_tax, :producer, :product_feed_list,
:rate, :related_items_description, :sales_description, :schedule_b_code, :schedule_b_number, :schedule_b_quantity,
:search_keywords, :ship_individually, :shipping_cost, :shipping_cost_units, :shopping_dot_com_category,
:shopzilla_category_id, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor,
:specials_description, :stock_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, :weight, :weight_unit, :weight_units
fields :amortization_period,
:available_to_partners,
:copy_description,
:cost,
:cost_estimate,
:cost_estimate_type,
:cost_estimate_units,
:cost_units,
:country_of_manufacture,
:created_date,
:currency,
:defer_rev_rec,
:direct_revenue_posting,
:display_name,
:dont_show_price,
:enforce_min_qty_internally,
:exclude_from_sitemap,
:featured_description,
:generate_accruals,
:handling_cost,
:handling_cost_units,
:hazmat_hazard_class,
:hazmat_id,
:hazmat_item_units,
:hazmat_item_units_qty,
:hazmat_packing_group,
:hazmat_shipping_name,
:include_children,
:is_donation_item,
:is_drop_ship_item,
:is_fulfillable,
:is_gco_compliant,
:is_hazmat_item,
:is_inactive,
:is_online,
:is_special_order_item,
:is_taxable,
:item_carrier,
:item_id,
:last_modified_date,
:manufacturer,
:manufacturer_addr1,
:manufacturer_city,
:manufacturer_state,
:manufacturer_tariff,
:manufacturer_tax_id,
:manufacturer_zip,
:matrix_item_name_template,
:matrix_type,
:max_donation_amount,
:maximum_quantity,
:meta_tag_html,
:minimum_quantity,
:minimum_quantity_units,
:mpn,
:mult_manufacture_addr,
:nex_tag_category,
:no_price_message,
:offer_support,
:on_special,
:out_of_stock_behavior,
:out_of_stock_message,
:overall_quantity_pricing_type,
:page_title,
:preference_criterion,
:prices_include_tax,
:producer,
: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,
:schedule_b_code,
:schedule_b_number,
:schedule_b_quantity,
:search_keywords,
:ship_individually,
:shipping_cost,
:shipping_cost_units,
:shopping_dot_com_category,
:shopzilla_category_id,
:show_default_donation_amount,
:sitemap_priority,
:soft_descriptor,
:specials_description,
:stock_description,
:store_description,
:store_detailed_description,
:store_display_name,
:upc_code,
:url_component,
:use_marginal_rates,
:vendor_name,
:vsoe_deferral,
:vsoe_delivered,
:vsoe_permit_discount,
:vsoe_price,
:vsoe_sop_group,
:weight,
:weight_unit,
:weight_units

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, :ship_package, :store_display_image,
:store_display_thumbnail, :store_item_template, :tax_schedule, :units_type, :expense_account
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,
:default_item_ship_method,
:deferral_account,
:deferred_revenue_account,
:department,
:dropship_expense_account,
:expense_account,
:income_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_rec_schedule,
:sales_tax_code,
:sale_unit,
:ship_package,
:store_display_image,
:store_display_thumbnail,
:store_item_template,
:tax_schedule,
:units_type,
:vendor

field :custom_field_list, CustomFieldList
field :item_ship_method_list, RecordRefList
field :matrix_option_list, MatrixOptionList
field :pricing_matrix, PricingMatrix
field :subsidiary_list, RecordRefList
field :item_vendor_list, ItemVendorList

# TODO: field :accounting_book_detail_list, ItemAccountingBookDetailList
# TODO: field :hierarchy_versions_list, NonInventoryResaleItemHierarchyVersionsList
# TODO: field :item_options_list, ItemOptionsList
# TODO: field :presentation_item_list, PresentationItemList
# TODO: field :product_feed_list, ProductFeedList
# TODO: field :site_category_list, SiteCategoryList
# TODO: field :translations_list, TranslationList

attr_reader :internal_id
attr_accessor :external_id
Expand Down
183 changes: 159 additions & 24 deletions spec/netsuite/records/non_inventory_resale_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,173 @@

it 'has the right fields' do
[
:available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture, :created_date,
:display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap,
:featured_description, :handling_cost, :handling_cost_units, :include_children, :is_donation_item, :is_fulfillable,
:is_gco_compliant, :is_inactive, :is_online, :is_taxable, :item_id, :last_modified_date, :manufacturer, :manufacturer_addr1,
:manufacturer_city, :manufacturer_state, :manufacturer_tariff, :manufacturer_tax_id, :manufacturer_zip, :matrix_option_list,
:matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity, :minimum_quantity_units, :mpn,
:mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
:out_of_stock_message, :overall_quantity_pricing_type, :page_title, :preference_criterion, :presentation_item_list,
:prices_include_tax, :producer, :product_feed_list, :rate, :related_items_description, :sales_description,
:schedule_b_code, :schedule_b_number, :schedule_b_quantity, :search_keywords, :ship_individually, :shipping_cost,
:shipping_cost_units, :shopping_dot_com_category, :shopzilla_category_id, :show_default_donation_amount,
:site_category_list, :sitemap_priority, :soft_descriptor, :specials_description, :stock_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, :weight, :weight_unit, :weight_units
:amortization_period,
:available_to_partners,
:copy_description,
:cost,
:cost_estimate,
:cost_estimate_type,
:cost_estimate_units,
:cost_units,
:country_of_manufacture,
:created_date,
:currency,
:defer_rev_rec,
:direct_revenue_posting,
:display_name,
:dont_show_price,
:enforce_min_qty_internally,
:exclude_from_sitemap,
:featured_description,
:generate_accruals,
:handling_cost,
:handling_cost_units,
:hazmat_hazard_class,
:hazmat_id,
:hazmat_item_units,
:hazmat_item_units_qty,
:hazmat_packing_group,
:hazmat_shipping_name,
:include_children,
:is_donation_item,
:is_drop_ship_item,
:is_fulfillable,
:is_gco_compliant,
:is_hazmat_item,
:is_inactive,
:is_online,
:is_special_order_item,
:is_taxable,
:item_carrier,
:item_id,
:last_modified_date,
:manufacturer,
:manufacturer_addr1,
:manufacturer_city,
:manufacturer_state,
:manufacturer_tariff,
:manufacturer_tax_id,
:manufacturer_zip,
:matrix_item_name_template,
:matrix_type,
:max_donation_amount,
:maximum_quantity,
:meta_tag_html,
:minimum_quantity,
:minimum_quantity_units,
:mpn,
:mult_manufacture_addr,
:nex_tag_category,
:no_price_message,
:offer_support,
:on_special,
:out_of_stock_behavior,
:out_of_stock_message,
:overall_quantity_pricing_type,
:page_title,
:preference_criterion,
:prices_include_tax,
:producer,
: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,
:schedule_b_code,
:schedule_b_number,
:schedule_b_quantity,
:search_keywords,
:ship_individually,
:shipping_cost,
:shipping_cost_units,
:shopping_dot_com_category,
:shopzilla_category_id,
:show_default_donation_amount,
:sitemap_priority,
:soft_descriptor,
:specials_description,
:stock_description,
:store_description,
:store_detailed_description,
:store_display_name,
:upc_code,
:url_component,
:use_marginal_rates,
:vendor_name,
:vsoe_deferral,
:vsoe_delivered,
:vsoe_permit_discount,
:vsoe_price,
:vsoe_sop_group,
:weight,
:weight_unit,
:weight_units,
].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)
expect(item.item_vendor_list.class).to eq(NetSuite::Records::ItemVendorList)

it 'has all the right fields with specific classes' do
{
custom_field_list: NetSuite::Records::CustomFieldList,
item_ship_method_list: NetSuite::Records::RecordRefList,
matrix_option_list: NetSuite::Records::MatrixOptionList,
pricing_matrix: NetSuite::Records::PricingMatrix,
subsidiary_list: NetSuite::Records::RecordRefList,
item_vendor_list: NetSuite::Records::ItemVendorList,
}.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, :ship_package, :store_display_image,
:store_display_thumbnail, :store_item_template, :tax_schedule, :units_type, :expense_account
: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,
:default_item_ship_method,
:deferral_account,
:deferred_revenue_account,
:department,
:dropship_expense_account,
:expense_account,
:income_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_rec_schedule,
:sales_tax_code,
:sale_unit,
:ship_package,
: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