Commit 6b54b091 authored by Jérome Perrin's avatar Jérome Perrin

Accepts redirect acrgument to add a portal status message (then this script...

Accepts redirect acrgument to add a portal status message (then this script can be used in object_action)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4781 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 15ad6209
...@@ -79,7 +79,7 @@ lines_portal_type = (\'Accounting Transaction Line\', \n ...@@ -79,7 +79,7 @@ lines_portal_type = (\'Accounting Transaction Line\', \n
\n \n
transaction = context.getObject()\n transaction = context.getObject()\n
\n \n
for line in transaction.searchFolder(portal_type=lines_portal_type) : \n for line in transaction.objectValues(portal_type=lines_portal_type) : \n
line = line.getObject()\n line = line.getObject()\n
# Do not delete lines involved in simulation\n # Do not delete lines involved in simulation\n
if len( line.getDeliveryRelatedValueList(portal_type = \'Simulation Movement\') + \n if len( line.getDeliveryRelatedValueList(portal_type = \'Simulation Movement\') + \n
...@@ -87,31 +87,40 @@ for line in transaction.searchFolder(portal_type=lines_portal_type) : \n ...@@ -87,31 +87,40 @@ for line in transaction.searchFolder(portal_type=lines_portal_type) : \n
balance = line.getSourceDebit() - line.getSourceCredit()\n balance = line.getSourceDebit() - line.getSourceCredit()\n
if balance == 0 : \n if balance == 0 : \n
transaction.deleteContent(line.getId())\n transaction.deleteContent(line.getId())\n
\n
if redirect :\n
context.REQUEST.RESPONSE.redirect("%s/view?portal_status_message=%s" % (\n
transaction.getPath(), context.Base_TranslateString(\'Empty Lines Deleted.\')))\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
<value> <string encoding="base64">YwAAAAAAAAAAAQAAAEAAAABzDQAAAGQBAIQAAFoAAGQAAFMoAgAAAE5jAAAAAAgAAAARAAAAQwAA <value> <string encoding="base64">YwAAAAAAAAAAAgAAAEAAAABzEAAAAGQBAGQCAIQBAFoAAGQAAFMoAwAAAE5pAAAAAGMBAAAACgAA
AHP6AAAAZAEAZAIAZAMAZAQAZAUAZAYAZg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IQARsBKAEAAABzJgAAAEFjY291bnRpbmdUcmFuc2FjdGlvbl9kZWxldGVFbXB0eUxpbmVzKAEA
AABzJgAAAEFjY291bnRpbmdUcmFuc2FjdGlvbl9kZWxldGVFbXB0eUxpbmVzKAAAAAAoAAAAAHMP
AAAAU2NyaXB0IChQeXRob24pcwgAAAA8bW9kdWxlPgEAAABzAAAAAA==</string> </value>
</item> </item>
<item> <item>
<key> <string>_filepath</string> </key> <key> <string>_filepath</string> </key>
...@@ -119,7 +128,7 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </ ...@@ -119,7 +128,7 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string>reditect = 0</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -139,12 +148,13 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </ ...@@ -139,12 +148,13 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>reditect</string>
<string>lines_portal_type</string> <string>lines_portal_type</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
...@@ -153,6 +163,7 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </ ...@@ -153,6 +163,7 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </
<string>line</string> <string>line</string>
<string>len</string> <string>len</string>
<string>balance</string> <string>balance</string>
<string>redirect</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -164,7 +175,9 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </ ...@@ -164,7 +175,9 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<none/> <tuple>
<int>0</int>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
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