From 38c794956a3df35d205bf7bed20c8ca5ec30494d Mon Sep 17 00:00:00 2001 From: Samuel Piquet Date: Fri, 6 Oct 2023 09:44:31 +1100 Subject: [PATCH] [FIX] applied sbidoul comments --- mis_builder/models/kpimatrix.py | 10 +++++----- mis_builder/models/mis_report_instance.py | 6 +++--- mis_builder/report/mis_report_instance_qweb.xml | 2 +- mis_builder/report/mis_report_instance_xlsx.py | 2 +- mis_builder/views/mis_report_instance.xml | 1 + 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/mis_builder/models/kpimatrix.py b/mis_builder/models/kpimatrix.py index 51bf8ee25..3bf8ef360 100644 --- a/mis_builder/models/kpimatrix.py +++ b/mis_builder/models/kpimatrix.py @@ -432,19 +432,19 @@ def compute_sums(self): tooltips=False, ) - def iter_rows(self, inverse_detail=False): + def iter_rows(self, details_before_kpi=False): """Iterate rows in display order. yields KpiMatrixRow. """ for kpi_row in self._kpi_rows.values(): - if not inverse_detail: + if not details_before_kpi: yield kpi_row detail_rows = self._detail_rows[kpi_row.kpi].values() detail_rows = sorted(detail_rows, key=lambda r: r.label) for detail_row in detail_rows: yield detail_row - if inverse_detail: + if details_before_kpi: yield kpi_row def iter_cols(self): @@ -483,7 +483,7 @@ def get_account_name(self, account_id): self._load_account_names() return self._account_names[account_id] - def as_dict(self, inverse_detail=False): + def as_dict(self, details_before_kpi=False): header = [{"cols": []}, {"cols": []}] for col in self.iter_cols(): header[0]["cols"].append( @@ -503,7 +503,7 @@ def as_dict(self, inverse_detail=False): ) body = [] - for row in self.iter_rows(inverse_detail=inverse_detail): + for row in self.iter_rows(details_before_kpi=details_before_kpi): if ( row.style_props.hide_empty and row.is_empty() ) or row.style_props.hide_always: diff --git a/mis_builder/models/mis_report_instance.py b/mis_builder/models/mis_report_instance.py index 8c0e92f66..5b98b6358 100644 --- a/mis_builder/models/mis_report_instance.py +++ b/mis_builder/models/mis_report_instance.py @@ -563,8 +563,8 @@ def _compute_pivot_date(self): display_columns_description = fields.Boolean( help="Display the date range details in the column headers." ) - inverse_detail = fields.Boolean( - help="Show detail before KPI.", + details_before_kpi = fields.Boolean( + help="Show account details before KPI.", ) comparison_mode = fields.Boolean( compute="_compute_comparison_mode", inverse="_inverse_comparison_mode" @@ -872,7 +872,7 @@ def _compute_matrix(self): def compute(self): self.ensure_one() kpi_matrix = self._compute_matrix() - return kpi_matrix.as_dict(inverse_detail=self.inverse_detail) + return kpi_matrix.as_dict(details_before_kpi=self.details_before_kpi) def drilldown(self, arg): self.ensure_one() diff --git a/mis_builder/report/mis_report_instance_qweb.xml b/mis_builder/report/mis_report_instance_qweb.xml index e12bb27e3..33388bf72 100644 --- a/mis_builder/report/mis_report_instance_qweb.xml +++ b/mis_builder/report/mis_report_instance_qweb.xml @@ -75,7 +75,7 @@
+