Browse Source

[WIP] mis_builder: auto-expand by account feature

pull/189/head
Stéphane Bidoul 9 years ago
parent
commit
fc2356d4e4
  1. 5
      mis_builder/models/mis_builder.py
  2. 3
      mis_builder/views/mis_builder.xml

5
mis_builder/models/mis_builder.py

@ -134,6 +134,7 @@ class MisReportKpi(models.Model):
compute='_compute_expression', compute='_compute_expression',
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')
default_css_style = fields.Char(string='Default CSS style') default_css_style = fields.Char(string='Default CSS style')
css_style = fields.Char(string='CSS style expression') css_style = fields.Char(string='CSS style expression')
type = fields.Selection([('num', _('Numeric')), type = fields.Selection([('num', _('Numeric')),
@ -617,8 +618,8 @@ class MisReport(models.Model):
# we assume there will be no errors, because it is a # we assume there will be no errors, because it is a
# the same as the kpi, just filtered on one account; # the same as the kpi, just filtered on one account;
# I'd say if we have an exception in this part, it's bug... # 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): for account_id in aep.get_accounts_in_expr(kpi.expression):
account_id_vals = [] account_id_vals = []
for expression in kpi.expression_ids: for expression in kpi.expression_ids:

3
mis_builder/views/mis_builder.xml

@ -135,6 +135,9 @@
attrs="{'invisible': [('multi', '=', True)], attrs="{'invisible': [('multi', '=', True)],
'readonly': [('multi', '=', True)]}"/> 'readonly': [('multi', '=', True)]}"/>
</group> </group>
<group string="Auto expand">
<field name="auto_expand_accounts"/>
</group>
<group col="2" string="Legend (for kpi expressions)"> <group col="2" string="Legend (for kpi expressions)">
<group> <group>
<label colspan="2" string="Expressions are of the form &lt;field&gt;&lt;mode&gt;[accounts][domain]"/> <label colspan="2" string="Expressions are of the form &lt;field&gt;&lt;mode&gt;[accounts][domain]"/>

Loading…
Cancel
Save