Browse Source

[FIX] mis_builder: fixes wrt subkpis and drilldown

pull/189/head
Stéphane Bidoul 9 years ago
parent
commit
8e34261c01
  1. 2
      mis_builder/models/aep.py
  2. 19
      mis_builder/models/mis_builder.py

2
mis_builder/models/aep.py

@ -191,7 +191,7 @@ class AccountingExpressionProcessor(object):
fy_date_from = \
company.compute_fiscalyear_dates(date_from_date)['date_from']
domain = ['|',
('date', '>=', fy_date_from),
('date', '>=', fields.Date.to_string(fy_date_from)),
('user_type_id.include_initial_balance', '=', True)]
if mode == MODE_INITIAL:
domain.append(('date', '<', date_from))

19
mis_builder/models/mis_builder.py

@ -978,7 +978,6 @@ class MisReportInstancePeriod(models.Model):
'dp': kpi.dp,
'is_percentage': kpi.type == 'pct',
'period_id': self.id,
'expr': kpi.expression, # TODO FIXME
'style': '',
'xlsx_style': {},
}
@ -998,24 +997,28 @@ class MisReportInstancePeriod(models.Model):
'drilldown': False,
})
else:
# TODO FIXME: has_account_var on each subkpi expression?
drilldown = (subkpi_val is not AccountingNone and
AEP.has_account_var(kpi.expression))
if kpi.multi:
expression = kpi.expression_ids[idx].name
comment = '{}.{} = {}'.format(
kpi.name,
kpi.expression_ids[idx].subkpi_id.name,
expression)
else:
expression = kpi.expression
# TODO FIXME: check we have meaningfulname for exploded
# kpis
comment = kpi.name + " = " + expression
comment = '{} = {}'.format(
kpi.name,
expression)
drilldown = (subkpi_val is not AccountingNone and
AEP.has_account_var(expression))
vals.update({
'val': (None
if subkpi_val is AccountingNone
else subkpi_val),
'val_r': kpi.render(lang_id, subkpi_val),
'val_c': comment,
'expr': expression,
'drilldown': drilldown,
})
})
res[kpi_name].append(vals)
return res

Loading…
Cancel
Save