From ce47e4d80b9d30943794d7023da9858cbbd1046b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 7 Dec 2006 17:34:57 +0000
Subject: [PATCH] update general ledger report to use new columns names in
 Account_viewAccountingTransactionList/listbox.
 Account_statCredit/Account_statDebit reinject selection parameters in the
 query, because general ledger uses Account_viewAccountingTransactionList with
 mirror_section_uid or payment_uid.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11641 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...dule_getGeneralLedgerReportSectionList.xml | 34 +++++++++++--------
 .../erp5_accounting/Account_statCredit.xml    |  3 ++
 .../erp5_accounting/Account_statDebit.xml     |  3 ++
 bt5/erp5_accounting/bt/revision               |  2 +-
 4 files changed, 26 insertions(+), 16 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 eee13c139d..70e473bd25 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
@@ -103,16 +103,19 @@ else:\n
 \n
 result = []\n
 \n
-account_columns = ( (\'date\', \'Date\')\n
-                  , (\'specific_reference\', \'Reference\')\n
-                  , (\'title\', \'Label\')\n
-                  , (\'translated_portal_type\', \'Type\')\n
-                  , (\'third_party\', \'Third Party\')\n
-                  , (\'translated_simulation_state_title\', \'State\')\n
-                  , (\'debit\', \'Debit\')\n
-                  , (\'credit\', \'Credit\')\n
-                  , (\'net_balance\', \'Balance\')\n
-                  )\n
+\n
+account_columns = (\n
+      (\'Movement_getSpecificReference\', \'Reference\'),\n
+      (\'Movement_getExplanationTitle\', \'Title\'),\n
+      (\'date\', \'Date\'),\n
+      (\'Movement_getExplanationTranslatedPortalType\', \'Type\'),\n
+      (\'Movement_getExplanationReference\', \'Invoice Number\'),\n
+      (\'Movement_getMirrorSectionTitle\', \'Third Party\'),\n
+      (\'getTranslatedSimulationStateTitle\', \'State\'),\n
+      (\'Movement_getDebitPrice\', \'Debit\'),\n
+      (\'Movement_getCreditPrice\', \'Credit\'),\n
+      (\'total_price\', \'Balance\'),\n
+      (\'running_total_price\', \'Net\'), )\n
 \n
 if gap:\n
   gap_value_list = [cat_tool.gap.restrictedTraverse(gap)] + \\\n
@@ -133,6 +136,7 @@ if account_inventory_list_cache_params.has_key(\'from_date\'):\n
   del account_inventory_list_cache_params[\'from_date\']\n
 \n
 for c in gap_value_list:\n
+  # FIXME: this part is not working !\n
   account_list = c.getGapRelatedValueList(portal_type="Account")\n
   strict_account_list = c.getGapRelatedValueList(portal_type="Account",\n
                                                  strict_membership=1)\n
@@ -167,8 +171,8 @@ for c in gap_value_list:\n
                                       at_date=at_date,\n
                                       simulation_state=simulation_state):\n
           third_party_params = params.copy()\n
-          third_party_params[\'mirror_section_uid\'] = third_party_brain.uid\n
           third_party_uid = third_party_brain.uid or " = NULL"\n
+          third_party_params[\'mirror_section_uid\'] = third_party_uid\n
           title = "%s: %s (%s)" % ( c.getId()\n
                                   , account.getTitle()\n
                                   , third_party_brain.title\n
@@ -186,7 +190,7 @@ for c in gap_value_list:\n
                       selection_params=third_party_params.copy(),\n
                       selection_columns=account_columns,\n
                       listbox_display_mode=\'FlatListMode\',\n
-                      selection_sort_order=[(\'delivery.stop_date\',\n
+                      selection_sort_order=[(\'stock.date\',\n
                                              \'ascending\')]))\n
 \n
       elif account.isMemberOf(\'account_type/asset/cash/bank\'):\n
@@ -196,8 +200,8 @@ for c in gap_value_list:\n
                                       simulation_state=simulation_state):\n
           bank_params = params.copy()\n
           if bank_account_brain.path is not None:\n
-            bank_params[\'payment_uid\'] = bank_account_brain.uid\n
             bank_account_uid = bank_account_brain.uid or " = NULL"\n
+            bank_params[\'payment_uid\'] = bank_account_uid\n
             title = "%s: %s (%s)" % ( c.getId()\n
                                     , account.getTitle()\n
                                     , bank_account_brain.title\n
@@ -218,7 +222,7 @@ for c in gap_value_list:\n
                       selection_params=bank_params.copy(),\n
                       selection_columns=account_columns,\n
                       listbox_display_mode=\'FlatListMode\',\n
-                      selection_sort_order=[(\'delivery.stop_date\',\n
+                      selection_sort_order=[(\'stock.date\',\n
                                              \'ascending\')]))\n
       elif len(sim_tool.getMovementHistoryList(\n
                                 node_uid=account.getUid(),\n
@@ -232,7 +236,7 @@ for c in gap_value_list:\n
                         selection_params=params,\n
                         selection_columns=account_columns,\n
                         listbox_display_mode=\'FlatListMode\',\n
-                        selection_sort_order=[(\'delivery.stop_date\',\n
+                        selection_sort_order=[(\'stock.date\',\n
                                                \'ascending\')]))\n
 \n
 return result\n
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_statCredit.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_statCredit.xml
index 7aeb7d982a..9b0c7a9e5d 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_statCredit.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_statCredit.xml
@@ -73,6 +73,8 @@ account as node\n
 """\n
 kw[\'node_uid\'] = context.getUid()\n
 kw[\'omit_input\'] = 1\n
+kw.update(kw[\'selection\'].getParams())\n
+\n
 # here, or 0 is to prevent displaying "- 0"\n
 return - context.Node_statAccountingBalance(**kw) or 0\n
 </string> </value>
@@ -121,6 +123,7 @@ return - context.Node_statAccountingBalance(**kw) or 0\n
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>_write_</string>
+                            <string>_getitem_</string>
                             <string>_apply_</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_statDebit.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_statDebit.xml
index 464ece3c17..a5deb32c20 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_statDebit.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_statDebit.xml
@@ -73,6 +73,8 @@ account as a node\n
 """\n
 kw[\'node_uid\'] = context.getUid()\n
 kw[\'omit_output\'] = 1\n
+kw.update(kw[\'selection\'].getParams())\n
+\n
 return context.Node_statAccountingBalance(**kw)\n
 </string> </value>
         </item>
@@ -120,6 +122,7 @@ return context.Node_statAccountingBalance(**kw)\n
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>_write_</string>
+                            <string>_getitem_</string>
                             <string>_apply_</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index aa59885c83..70e1a64c23 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-143
\ No newline at end of file
+144
\ No newline at end of file
-- 
2.30.9