Commit 6980b03c authored by Jérome Perrin's avatar Jérome Perrin

don't store persistent objects in the selection



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13025 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent da602460
......@@ -74,6 +74,8 @@ from Products.PythonScripts.standard import Object\n
\n
object_list = []\n
movement_urls = {}\n
# retrieve movement_list from the cache\n
movement_list = container.REQUEST.get(movement_list_key)\n
\n
def getListItemUrl(alias, idx, selection_name):\n
return movement_urls[idx]\n
......@@ -141,7 +143,7 @@ return object_list\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>selection, stat=0, node_relative_url=\'\', movement_list=\'\', **kw</string> </value>
<value> <string>selection, stat=0, node_relative_url=\'\', movement_list_key=\'\', **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -170,17 +172,19 @@ return object_list\n
<string>selection</string>
<string>stat</string>
<string>node_relative_url</string>
<string>movement_list</string>
<string>movement_list_key</string>
<string>kw</string>
<string>Products.PythonScripts.standard</string>
<string>Object</string>
<string>object_list</string>
<string>movement_urls</string>
<string>_getattr_</string>
<string>container</string>
<string>movement_list</string>
<string>getListItemUrl</string>
<string>idx</string>
<string>_getiter_</string>
<string>movement</string>
<string>_getattr_</string>
<string>debit</string>
<string>credit</string>
<string>node</string>
......
......@@ -70,6 +70,7 @@
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Form.Report import ReportSection\n
portal = context.getPortalObject()\n
request = portal.REQUEST\n
result = []\n
lines = {}\n
\n
......@@ -84,13 +85,18 @@ for transaction in context.\\\n
lines.setdefault(line.getDestinationValue(), []).append(line)\n
\n
for node, movement_list in lines.items():\n
# store movement_list in REQUEST (storing persistent \n
# objects in selection is forbidden)\n
movement_list_key = id(movement_list)\n
request.set(movement_list_key, movement_list)\n
\n
if node is not None:\n
result.append(ReportSection(\n
path=context.getPhysicalPath(),\n
form_id=\'AccountingTransaction_viewExplanationReportSection\',\n
selection_name=\'accounting_transaction_explanation_line_list_selection\',\n
selection_params=dict(node_relative_url=node.getRelativeUrl(),\n
movement_list=movement_list,\n
movement_list_key=movement_list_key,\n
listbox_title=\'%s - %s\' % (node.getId(),\n
node.getTitle())),\n
listbox_display_mode = \'FlatListMode\',\n
......@@ -150,6 +156,7 @@ return result\n
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>request</string>
<string>result</string>
<string>lines</string>
<string>_getiter_</string>
......@@ -158,6 +165,8 @@ return result\n
<string>line</string>
<string>node</string>
<string>movement_list</string>
<string>id</string>
<string>movement_list_key</string>
<string>None</string>
<string>dict</string>
</tuple>
......
77
\ No newline at end of file
78
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment