From bd13141c04c72978832e85ed26eef8d7aa02ed83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 4 Oct 2006 13:21:18 +0000
Subject: [PATCH] if 'hide_grouping' is true, do not show movements having a
 grouping reference.

In the current configuration, stats shows the total, this is intentional,
because if a movement A (date=2006/12/20) is grouped with a movement B
(date=2007/01/01), the stat should show movement A, even if he is grouped. This
is also a way to see grouping errors.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10534 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Node_getAccountingTransactionList.xml      | 18 +++++++++++++-----
 bt5/erp5_accounting/bt/revision                |  2 +-
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml
index 775ac3591f..6f9df9f34a 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml
@@ -68,7 +68,9 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>from Products.ERP5Type.Message import Message\n
+            <value> <string encoding="cdata"><![CDATA[
+
+from Products.ERP5Type.Message import Message\n
 portal = context.getPortalObject()\n
 params = portal.ERP5Accounting_getParams(selection)\n
 N_ = lambda msg: Message(\'erp5_ui\', msg)\n
@@ -99,7 +101,7 @@ net_balance = 0.0\n
 \n
 if from_date:\n
   # Create a new parameter list to get the previous balance\n
-  get_inventory_kw = params.copy()\n
+  get_inventory_kw = params.copy() # do not include omit_grouping here\n
   get_inventory_kw[\'to_date\'] = from_date\n
   # TODO: using a list of section_uid \n
   # \'where_expression\': " section.portal_type = \'Organisation\' " \n
@@ -141,6 +143,8 @@ if from_date:\n
         getTranslatedSimulationStateTitle=\'\',\n
       )\n
     new_result = [previous_balance]\n
+    if selection.getParams().get(\'hide_grouping\'):\n
+      params[\'where_expression\'] = \'catalog.grouping_reference is NULL\'\n
     new_result.extend(\n
       portal.portal_simulation.getMovementHistoryList(\n
                    from_date=from_date,\n
@@ -162,8 +166,10 @@ context.log(\'sql\\nparams=%s\\nsort_on=%s\' % (params, sort_on),\n
                  sort_on=sort_on,\n
                  src__=1,\n
                  **params))\n
-  \n
-# We try not to convert to a list.\n
+\n
+if selection.getParams().get(\'hide_grouping\'):\n
+  params[\'where_expression\'] = \'catalog.grouping_reference is NULL\'\n
+# We try not to convert to a list, hence the copy & paste\n
 return portal.portal_simulation.getMovementHistoryList(\n
                  from_date=from_date,\n
                  initial_running_total_price=net_balance,\n
@@ -172,7 +178,9 @@ return portal.portal_simulation.getMovementHistoryList(\n
                  selection_domain_join_column=\'section_uid\',\n
                  sort_on=sort_on,\n
                  **params)\n
-</string> </value>
+
+
+]]></string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index 4800c7da68..fc9afb48e0 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-58
\ No newline at end of file
+59
\ No newline at end of file
-- 
2.30.9