From dafbefe8e38344469788db4784997f05c3d48913 Mon Sep 17 00:00:00 2001 From: Mohamed ABDELLANI Date: Wed, 23 Nov 2022 09:50:34 +0100 Subject: [PATCH] add sku to OCST report as hidden by default column --- lib/reporting/reports/orders_and_fulfillment/base.rb | 4 ++++ .../orders_and_fulfillment/order_cycle_supplier_totals.rb | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/reporting/reports/orders_and_fulfillment/base.rb b/lib/reporting/reports/orders_and_fulfillment/base.rb index 887a39c5a1..d4e269184b 100644 --- a/lib/reporting/reports/orders_and_fulfillment/base.rb +++ b/lib/reporting/reports/orders_and_fulfillment/base.rb @@ -43,6 +43,10 @@ module Reporting proc { |line_items| line_items.first.variant.full_name } end + def variant_sku + proc { |line_items| line_items.first.variant.sku } + end + def supplier_name proc { |line_items| line_items.first.variant.product.supplier.name } end diff --git a/lib/reporting/reports/orders_and_fulfillment/order_cycle_supplier_totals.rb b/lib/reporting/reports/orders_and_fulfillment/order_cycle_supplier_totals.rb index 3b242225df..7646c4ceae 100644 --- a/lib/reporting/reports/orders_and_fulfillment/order_cycle_supplier_totals.rb +++ b/lib/reporting/reports/orders_and_fulfillment/order_cycle_supplier_totals.rb @@ -12,7 +12,8 @@ module Reporting quantity: proc { |line_items| line_items.sum(&:quantity) }, total_units: proc { |line_items| total_units(line_items) }, curr_cost_per_unit: proc { |line_items| line_items.first.price }, - total_cost: proc { |line_items| line_items.sum(&:amount) } + total_cost: proc { |line_items| line_items.sum(&:amount) }, + sku: variant_sku } end @@ -41,6 +42,10 @@ module Reporting [e.variant_id, e.price] }.values end + + def default_params + super.merge({ fields_to_hide: ["sku"] }) + end end end end