mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
add sku to OCST report as hidden by default column
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user