From fc2356d4e445da7d62181b7d1b6adb36b3c147c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Thu, 28 Apr 2016 22:45:47 +0200 Subject: [PATCH] [WIP] mis_builder: auto-expand by account feature --- mis_builder/models/mis_builder.py | 5 +++-- mis_builder/views/mis_builder.xml | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mis_builder/models/mis_builder.py b/mis_builder/models/mis_builder.py index 7591c282..b9d35a8a 100644 --- a/mis_builder/models/mis_builder.py +++ b/mis_builder/models/mis_builder.py @@ -134,6 +134,7 @@ class MisReportKpi(models.Model): compute='_compute_expression', inverse='_inverse_expression') expression_ids = fields.One2many('mis.report.kpi.expression', 'kpi_id') + auto_expand_accounts = fields.Boolean(string='Display details by account') default_css_style = fields.Char(string='Default CSS style') css_style = fields.Char(string='CSS style expression') type = fields.Selection([('num', _('Numeric')), @@ -617,8 +618,8 @@ class MisReport(models.Model): # we assume there will be no errors, because it is a # the same as the kpi, just filtered on one account; # I'd say if we have an exception in this part, it's bug... - # TODO FIXME: do this only if requested for this KPI - continue + if not kpi.auto_expand_accounts: + continue for account_id in aep.get_accounts_in_expr(kpi.expression): account_id_vals = [] for expression in kpi.expression_ids: diff --git a/mis_builder/views/mis_builder.xml b/mis_builder/views/mis_builder.xml index df80f979..ff56ea94 100644 --- a/mis_builder/views/mis_builder.xml +++ b/mis_builder/views/mis_builder.xml @@ -135,6 +135,9 @@ attrs="{'invisible': [('multi', '=', True)], 'readonly': [('multi', '=', True)]}"/> + + +