From 189483bba6b218425c1bc537e631a06a015071d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= <stephane.bidoul@acsone.eu> Date: Mon, 23 May 2016 18:29:46 +0200 Subject: [PATCH] [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. --- mis_builder/models/aep.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mis_builder/models/aep.py b/mis_builder/models/aep.py index d08ab7c9..e50f84cc 100644 --- a/mis_builder/models/aep.py +++ b/mis_builder/models/aep.py @@ -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) + ')'