From 60a7722d641b0ad875e763f05f77132537740af8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 12 Sep 2013 17:37:45 +0200
Subject: [PATCH] Other Parties Report: check that *rounded* balance == 0 to
 hide balanced accounts

---
 .../AccountModule_getOtherPartiesReportSectionList.xml    | 8 ++++++--
 bt5/erp5_accounting/bt/revision                           | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getOtherPartiesReportSectionList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getOtherPartiesReportSectionList.xml
index f793b80a31..ecdeba45d8 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getOtherPartiesReportSectionList.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getOtherPartiesReportSectionList.xml
@@ -65,9 +65,12 @@ simulation_state = request[\'simulation_state\']\n
 role_filter_list = request.get(\'mirror_section_category_list\', None)\n
 omit_balanced_accounts = request[\'omit_balanced_accounts\']\n
 from_date = request.get(\'from_date\', None)\n
-gap_root = request.get(\'gap_root\', None)\n
 project = request.get(\'project\', None)\n
 \n
+currency = portal.Base_getCurrencyForSection(request[\'section_category\'])\n
+precision = portal.account_module.getQuantityPrecisionFromResource(currency)\n
+request.set(\'precision\', precision)\n
+\n
 request.other[\'is_accounting_report\'] = True\n
 \n
 # role_filter_list == None means no filter on the role\n
@@ -140,11 +143,12 @@ for party in context.Account_zDistinctSectionList(\n
     if omit_balanced_accounts and (\n
         round(simulation_tool.getInventoryAssetPrice(\n
                     mirror_section_uid=party.uid,\n
+                    precision=precision,\n
                     node_category_strict_membership=(\n
                           \'account_type/asset/receivable\',\n
                           \'account_type/liability/payable\'),\n
                     **params\n
-                    ), 3) == 0.):\n
+                    ), precision) == 0.):\n
       pass\n
     else:\n
       title = o.getTitle()\n
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index 75fe09e0ee..a4156eded6 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-1544
\ No newline at end of file
+1545
\ No newline at end of file
-- 
2.30.9