|
|
for rec in self:
action = {
"pivot_measures": [],
"pivot_row_groupby": [],
"pivot_column_groupby": [],
}
for field in rec.bi_sql_view_field_ids.filtered(
lambda x: x.graph_type == "measure"
):
action["pivot_measures"].append(field.name)
# If no measure are defined, we display by default the count
# of the element, to avoid an empty view
if not action["pivot_measures"]:
action["pivot_measures"] = ["__count__"]
for field in rec.bi_sql_view_field_ids.filtered(
lambda x: x.graph_type == "row"
):
action["pivot_row_groupby"].append(field.name)
for field in rec.bi_sql_view_field_ids.filtered(
lambda x: x.graph_type == "col"
):
action["pivot_column_groupby"].append(field.name)
rec.computed_action_context = str(action)
|
|