From 126590eb0d18da7a227ef6f10c41c233e865b76e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 7 Apr 2010 16:41:57 +0000
Subject: [PATCH] if we want to make it possible to extend account_type/expense
 and account_type/income, we have to do it differently, because this report
 depends on the fact that node_category and node_category_strict_membership
 are used in the same time, which only takes nodes that are member of boths
 node_category and node_category_strict_membership. This repairs GL with GAP
 filtering

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34336 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...odule_getGeneralLedgerReportSectionList.xml | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml
index 66873c79c3..03c3f92ec1 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml
@@ -168,9 +168,12 @@ account_type_to_group_by_node = [\n
                   \'account_type/equity\',\n
                   \'account_type/liability\',]\n
 \n
-profit_and_loss_account_type = [\n
-                  \'account_type/expense\',\n
-                  \'account_type/income\',]\n
+profit_and_loss_account_type = []\n
+for account_type_value in (cat_tool.account_type.expense,\n
+                     cat_tool.account_type.income):\n
+  profit_and_loss_account_type.extend(\n
+      [category.getRelativeUrl() for category in\n
+        account_type_value.getIndexableChildValueList()])\n
 \n
 account_type_to_group_by_payment = [ \'account_type/asset/cash/bank\' ]\n
 \n
@@ -255,10 +258,9 @@ for inventory in portal.portal_simulation.getInventoryList(\n
                                              \'ascending\')]))\n
 \n
 \n
-\n
 # profit & loss -> same, but from date limited to the current period\n
 for inventory in portal.portal_simulation.getInventoryList(\n
-                            node_category=profit_and_loss_account_type,\n
+                            node_category_strict_membership=profit_and_loss_account_type,\n
                             portal_type=portal.getPortalAccountingMovementTypeList(),\n
                             from_date=max(from_date, period_start_date),\n
                             at_date=at_date,\n
@@ -513,11 +515,15 @@ return report_section_list\n
                             <string>getFullAccountName</string>
                             <string>account_type_to_group_by_node</string>
                             <string>profit_and_loss_account_type</string>
+                            <string>_getiter_</string>
+                            <string>account_type_value</string>
+                            <string>append</string>
+                            <string>$append0</string>
+                            <string>category</string>
                             <string>account_type_to_group_by_payment</string>
                             <string>account_type_to_group_by_mirror_section</string>
                             <string>report_section_list</string>
                             <string>existing_section_dict</string>
-                            <string>_getiter_</string>
                             <string>_apply_</string>
                             <string>inventory</string>
                             <string>key</string>
-- 
2.30.9