Browse Source

[IMP] mis_buidler: avoid non-sense % comparisons with base value close to 0

pull/86/head
Stéphane Bidoul 10 years ago
parent
commit
afdf1002d7
  1. 13
      mis_builder/models/mis_builder.py

13
mis_builder/models/mis_builder.py

@ -196,12 +196,13 @@ class mis_report_kpi(orm.Model):
kpi.divider, kpi.dp, kpi.divider, kpi.dp,
kpi.suffix, sign='+', kpi.suffix, sign='+',
context=context) context=context)
elif kpi.compare_method == 'pct' and base_value != 0:
return self._render_num(cr, uid, lang_id,
value / base_value - 1,
0.01, kpi.dp,
'%', sign='+',
context=context)
elif kpi.compare_method == 'pct':
if round(base_value, kpi.dp) != 0:
return self._render_num(cr, uid, lang_id,
value / base_value - 1,
0.01, kpi.dp,
'%', sign='+',
context=context)
return '' return ''
def _render_num(self, cr, uid, lang_id, value, divider, def _render_num(self, cr, uid, lang_id, value, divider,

Loading…
Cancel
Save