From e3914ed3063c6af5a5d91cb8caaed085db0b7ffc Mon Sep 17 00:00:00 2001 From: Mohamed ABDELLANI Date: Mon, 28 Nov 2022 12:06:24 +0100 Subject: [PATCH] add final_weight_volume column to the hidden by default column of OCCT report --- config/locales/en.yml | 1 + .../order_cycle_customer_totals.rb | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index f3274533d2..5094cfd038 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2866,6 +2866,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using report_header_delivery_postcode: Delivery Postcode report_header_bulk_unit_size: Bulk Unit Size report_header_weight: Weight + report_header_final_weight_volume: Final (Weight/Volume) report_header_height: Height report_header_width: Width report_header_depth: Depth diff --git a/lib/reporting/reports/orders_and_fulfillment/order_cycle_customer_totals.rb b/lib/reporting/reports/orders_and_fulfillment/order_cycle_customer_totals.rb index 2ee552ea70..22ef77080a 100644 --- a/lib/reporting/reports/orders_and_fulfillment/order_cycle_customer_totals.rb +++ b/lib/reporting/reports/orders_and_fulfillment/order_cycle_customer_totals.rb @@ -64,6 +64,7 @@ module Reporting order_number: proc { |line_items| line_items.first.order.number }, date: proc { |line_items| line_items.first.order.completed_at.strftime("%F %T") }, + final_weight_volume: proc { |line_items| line_items.sum(&:final_weight_volume) }, } end # rubocop:enable Metrics/AbcSize @@ -101,6 +102,14 @@ module Reporting }.values end + def default_params + super.merge( + { + fields_to_hide: [:final_weight_volume] + } + ) + end + private def row_header(row)