From 43f5a275c3051ae15c36681ac4c2bac5ace14657 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 20 Nov 2009 13:11:15 +0000
Subject: [PATCH] modernize this script and support empty listboxs

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30787 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Base_jumpToAccountingTransaction.xml      | 39 ++++++-------------
 bt5/erp5_accounting/bt/revision               |  2 +-
 2 files changed, 13 insertions(+), 28 deletions(-)

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_jumpToAccountingTransaction.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_jumpToAccountingTransaction.xml
index d620fb6f0b..26ca294e9a 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_jumpToAccountingTransaction.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_jumpToAccountingTransaction.xml
@@ -53,35 +53,21 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-# You can use this script to jump to accounting module without making the URL longer.\n
-# Like \'erp5/organisation/purchase_order/accounting/view\'.\n
-#\n
-# Usage: .../Base_jumpToAccountingTransaction?from_entity=1\n
+            <value> <string># Usage: .../Base_jumpToAccountingTransaction?from_entity=1\n
 #\n
 # Use from_account to display only transaction related to the account you come from, and from_entity if you come from an organisation or person\n
 \n
-request=context.REQUEST\n
-\n
-redirect_url = \'%s/accounting_module/view\' % context.getPortalObject().absolute_url()\n
-\n
-separator = \'?\'\n
+redirect_kw = dict(reset=1,\n
+                   ignore_hide_rows=True)\n
 \n
 if from_account:\n
-  redirect_url += \'%snode:list=%s\' % (separator, context.getRelativeUrl())\n
-  separator = \'&\'\n
-\n
+  redirect_kw[\'node\'] = [context.getRelativeUrl()]\n
 elif from_entity:\n
-  redirect_url += \'%sentity=%s\' % (separator, context.getRelativeUrl())\n
-  separator = \'&\'\n
-\n
-redirect_url += \'%sreset=1\' % separator\n
+  redirect_kw[\'entity\'] = context.getRelativeUrl()\n
 \n
-request[ \'RESPONSE\' ].redirect( redirect_url )\n
-
-
-]]></string> </value>
+return context.getPortalObject().accounting_module.Base_redirect(\n
+              \'view\', keep_items=redirect_kw)\n
+</string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -119,13 +105,12 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
                           <tuple>
                             <string>from_account</string>
                             <string>from_entity</string>
+                            <string>dict</string>
+                            <string>True</string>
+                            <string>redirect_kw</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>request</string>
-                            <string>redirect_url</string>
-                            <string>separator</string>
-                            <string>_inplacevar_</string>
-                            <string>_getitem_</string>
+                            <string>_write_</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index 09fef806d9..2d677318be 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-1035
\ No newline at end of file
+1039
\ No newline at end of file
-- 
2.30.9