Browse Source

[WIP] mis_builder refactoring: split compute method

So the matrix computation can be used without the json rendering.
pull/189/head
Stéphane Bidoul 9 years ago
parent
commit
8e9a245dd2
  1. 8
      mis_builder/models/mis_report_instance.py

8
mis_builder/models/mis_report_instance.py

@ -378,7 +378,7 @@ class MisReportInstance(models.Model):
} }
@api.multi @api.multi
def compute(self):
def _compute_matrix(self):
self.ensure_one() self.ensure_one()
aep = self.report_id._prepare_aep(self.company_id) aep = self.report_id._prepare_aep(self.company_id)
kpi_matrix = self.report_id._prepare_kpi_matrix() kpi_matrix = self.report_id._prepare_kpi_matrix()
@ -407,4 +407,10 @@ class MisReportInstance(models.Model):
for comparison_column in period.comparison_column_ids: for comparison_column in period.comparison_column_ids:
kpi_matrix.declare_comparison(period.id, comparison_column.id) kpi_matrix.declare_comparison(period.id, comparison_column.id)
kpi_matrix.compute_comparisons() kpi_matrix.compute_comparisons()
return kpi_matrix
@api.multi
def compute(self):
self.ensure_one()
kpi_matrix = self._compute_matrix()
return kpi_matrix.as_dict() return kpi_matrix.as_dict()
Loading…
Cancel
Save