class GroupByReport(ReportView):
report_model = SalesTransaction
report_title = _("Group By Report")
report_description = _("Groups sales by product with no date_field set. "
"Shows that it's optional — omitting it gives all-time totals "
"regardless of the date pickers.")
# date_field = "date"
group_by = "product"
columns = [
"name",
ComputationField.create(
method=Sum,
field="value",
name="value__sum",
verbose_name="Total sold $",
is_summable=True,
),
]
# Charts
chart_settings = [
Chart(
"Total sold $",
Chart.BAR,
data_source=["value__sum"],
title_source=["name"],
),
]