Merge pull request #11251 from jibees/11207-update-all-products-report-to-include-stock

Admin, Products & Inventory reports: add `on_hand` and `on_demand?` columns by default ; mark `Inventory (on hand)` report as deprecated
This commit is contained in:
Filipe
2023-07-21 17:07:00 +01:00
committed by GitHub
5 changed files with 11 additions and 10 deletions

View File

@@ -2,4 +2,7 @@
- report_subtypes.each do |report_subtype|
%li
- url = main_app.admin_report_path(report_type: report_type, report_subtype: report_subtype[1])
= link_to report_subtype[0], url
- if report_subtype.dig(2, :deprecated)
%strike= link_to report_subtype[0], url, title: t('admin.reports.deprecated')
- else
= link_to report_subtype[0], url

View File

@@ -1458,6 +1458,7 @@ en:
email_confirmation: "Email confirmation is pending. We've sent a confirmation email to %{email}."
not_visible: "%{enterprise} is not visible and so cannot be found on the map or in searches"
reports:
deprecated: "This report is deprecated and will be removed in a future release."
hidden: HIDDEN
unitsize: UNITSIZE
total: TOTAL

View File

@@ -40,7 +40,7 @@ module Reporting
def products_and_inventory_report_types
[
[i18n_translate("all_products"), :all_products],
[i18n_translate("inventory"), :inventory],
[i18n_translate("inventory"), :inventory, { deprecated: true }],
[i18n_translate("lettuce_share"), :lettuce_share]
]
end

View File

@@ -4,10 +4,6 @@ module Reporting
module Reports
module ProductsAndInventory
class AllProducts < Base
def default_params
{ fields_to_hide: [:on_demand, :on_hand] }
end
def message
I18n.t("spree.admin.reports.products_and_inventory.all_products.message")
end

View File

@@ -423,22 +423,23 @@ describe '
expect(page).to have_content "Supplier"
expect(page).to have_table_row ["Supplier", "Producer Suburb", "Product",
"Product Properties", "Taxons", "Variant Value", "Price",
"Group Buy Unit Quantity", "Amount", "SKU"].map(&:upcase)
"Group Buy Unit Quantity", "Amount", "SKU",
"On demand?", "On hand"].map(&:upcase)
expect(page).to have_table_row [product1.supplier.name, product1.supplier.address.city,
"Product Name",
product1.properties.map(&:presentation).join(", "),
product1.primary_taxon.name, "1g", "100.0",
"none", "", "sku1"]
"none", "", "sku1", "No", "10"]
expect(page).to have_table_row [product1.supplier.name, product1.supplier.address.city,
"Product Name",
product1.properties.map(&:presentation).join(", "),
product1.primary_taxon.name, "1g", "80.0",
"none", "", "sku2"]
"none", "", "sku2", "No", "20"]
expect(page).to have_table_row [product2.supplier.name, product1.supplier.address.city,
"Product 2",
product1.properties.map(&:presentation).join(", "),
product2.primary_taxon.name, "100g", "99.0",
"none", "", "product_sku"]
"none", "", "product_sku", "No", "9"]
end
it "shows the LettuceShare report" do