Browse Source

[IMP] mis_builder: style for auto-expanded detail rows

pull/189/head
Stéphane Bidoul 9 years ago
parent
commit
d66f7b92fc
  1. 12
      mis_builder/models/mis_report.py
  2. 7
      mis_builder/views/mis_builder.xml

12
mis_builder/models/mis_report.py

@ -53,7 +53,7 @@ class KpiMatrixRow(object):
if not self.account_id: if not self.account_id:
return self.kpi.style return self.kpi.style
else: else:
return None # TODO style for expanded accounts
return self.kpi.auto_expand_accounts_style
@property @property
def row_id(self): def row_id(self):
@ -421,14 +421,20 @@ class MisReportKpi(models.Model):
inverse='_inverse_expression') inverse='_inverse_expression')
expression_ids = fields.One2many('mis.report.kpi.expression', 'kpi_id') expression_ids = fields.One2many('mis.report.kpi.expression', 'kpi_id')
auto_expand_accounts = fields.Boolean(string='Display details by account') 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( style = fields.Many2one(
string="Default style for KPI",
string="Row style",
comodel_name="mis.report.kpi.style", comodel_name="mis.report.kpi.style",
required=False required=False
) )
style_expression = fields.Char( style_expression = fields.Char(
string='Style expression', 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')), type = fields.Selection([('num', _('Numeric')),
('pct', _('Percentage')), ('pct', _('Percentage')),
('str', _('String'))], ('str', _('String'))],

7
mis_builder/views/mis_builder.xml

@ -141,8 +141,8 @@
attrs="{'invisible': [('type', '=', 'str')]}"/> attrs="{'invisible': [('type', '=', 'str')]}"/>
<field name="prefix"/> <field name="prefix"/>
<field name="suffix"/> <field name="suffix"/>
<field name="style" colspan="4"/>
<field name="style_expression" colspan="4"/>
<field name="style"/>
<field name="style_expression"/>
<!--<field name="sequence" />--> <!--<field name="sequence" />-->
</group> </group>
<group string="Expression"> <group string="Expression">
@ -159,8 +159,9 @@
attrs="{'invisible': [('multi', '=', True)], attrs="{'invisible': [('multi', '=', True)],
'readonly': [('multi', '=', True)]}"/> 'readonly': [('multi', '=', True)]}"/>
</group> </group>
<group string="Auto expand">
<group col="4" string="Auto expand">
<field name="auto_expand_accounts"/> <field name="auto_expand_accounts"/>
<field name="auto_expand_accounts_style"/>
</group> </group>
<group col="2" string="Legend (for kpi expressions)"> <group col="2" string="Legend (for kpi expressions)">
<group> <group>

Loading…
Cancel
Save