From d66f7b92fcbcfd46a2c7784251b6a00f54a87c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Fri, 13 May 2016 08:24:41 +0200 Subject: [PATCH] [IMP] mis_builder: style for auto-expanded detail rows --- mis_builder/models/mis_report.py | 12 +++++++++--- mis_builder/views/mis_builder.xml | 7 ++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mis_builder/models/mis_report.py b/mis_builder/models/mis_report.py index 411efdb5..a2e20b30 100644 --- a/mis_builder/models/mis_report.py +++ b/mis_builder/models/mis_report.py @@ -53,7 +53,7 @@ class KpiMatrixRow(object): if not self.account_id: return self.kpi.style else: - return None # TODO style for expanded accounts + return self.kpi.auto_expand_accounts_style @property def row_id(self): @@ -421,14 +421,20 @@ class MisReportKpi(models.Model): inverse='_inverse_expression') expression_ids = fields.One2many('mis.report.kpi.expression', 'kpi_id') auto_expand_accounts = fields.Boolean(string='Display details by account') + auto_expand_accounts_style = fields.Many2one( + string="Style for account detail rows", + comodel_name="mis.report.kpi.style", + required=False + ) style = fields.Many2one( - string="Default style for KPI", + string="Row style", comodel_name="mis.report.kpi.style", required=False ) style_expression = fields.Char( string='Style expression', - help='An expression that returns a style name for the kpi style') + help='An expression that returns a style depending on the KPI value. ' + 'Such style is applied on top of the row style.') type = fields.Selection([('num', _('Numeric')), ('pct', _('Percentage')), ('str', _('String'))], diff --git a/mis_builder/views/mis_builder.xml b/mis_builder/views/mis_builder.xml index 40341e5f..7e725031 100644 --- a/mis_builder/views/mis_builder.xml +++ b/mis_builder/views/mis_builder.xml @@ -141,8 +141,8 @@ attrs="{'invisible': [('type', '=', 'str')]}"/> - - + + @@ -159,8 +159,9 @@ attrs="{'invisible': [('multi', '=', True)], 'readonly': [('multi', '=', True)]}"/> - + +