[IMP] mis_builder: change precision rounding from 2 to 4 to distinguish 0 from null in initial balances

This should be slightly on the safer side. Ideally, this rounding precision
should come from the kpi style (which defaults to the report style), but
that would be a lot of code for little benefits.
pull/189/head
Stéphane Bidoul 2016-05-23 18:29:46 +02:00
parent f4a9b0d082
commit 189483bba6
1 changed files with 3 additions and 3 deletions

View File

@ -266,7 +266,7 @@ class AccountingExpressionProcessor(object):
debit = acc['debit'] or 0.0
credit = acc['credit'] or 0.0
if mode in (self.MODE_INITIAL, self.MODE_UNALLOCATED) and \
float_is_zero(debit-credit, precision_rounding=2):
float_is_zero(debit-credit, precision_rounding=4):
# in initial mode, ignore accounts with 0 balance
continue
self._data[key][acc['account_id'][0]] = (debit, credit)
@ -311,7 +311,7 @@ class AccountingExpressionProcessor(object):
# as it does not make sense to distinguish 0 from "no data"
if v is not AccountingNone and \
mode in (self.MODE_INITIAL, self.MODE_UNALLOCATED) and \
float_is_zero(v, precision_rounding=2):
float_is_zero(v, precision_rounding=4):
v = AccountingNone
return '(' + repr(v) + ')'
@ -342,7 +342,7 @@ class AccountingExpressionProcessor(object):
# as it does not make sense to distinguish 0 from "no data"
if v is not AccountingNone and \
mode in (self.MODE_INITIAL, self.MODE_UNALLOCATED) and \
float_is_zero(v, precision_rounding=2):
float_is_zero(v, precision_rounding=4):
v = AccountingNone
return '(' + repr(v) + ')'