Commit 28cc5826 authored by Jérome Perrin's avatar Jérome Perrin

Fix for new portal types:

* specify the action priority in PortalType_addAction, because new added action is no longer the last one
* Don't call listActions in PortalType_deleteAction, this method is now private

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29583 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a3ecfaf1
......@@ -55,7 +55,7 @@
<key> <string>_body</string> </key>
<value> <string>"""Add or replace an action on a type informations from types tool.\n
"""\n
assert context.meta_type == \'ERP5 Type Information\'\n
assert context.meta_type in (\'ERP5 Type Information\', \'ERP5 Base Type\'), context.meta_type\n
\n
context.PortalType_deleteAction(id=id)\n
\n
......@@ -66,6 +66,7 @@ context.addAction( id = id\n
, permission = permission\n
, category = category\n
, icon = icon\n
, priority = 10.0\n
)\n
\n
return \'Set Successfully.\'\n
......
......@@ -55,15 +55,23 @@
<key> <string>_body</string> </key>
<value> <string>"""Delete an action on a type informations from types tool.\n
"""\n
assert context.meta_type == \'ERP5 Type Information\'\n
assert context.meta_type in (\'ERP5 Type Information\', \'ERP5 Base Type\'), context.meta_type\n
\n
existing_actions_indexs = []\n
for idx, ai in enumerate(context.listActions()):\n
if context.meta_type == \'ERP5 Type Information\':\n
existing_actions_indexs = []\n
for idx, ai in enumerate(context.listActions()):\n
if ai.getId() == id:\n
existing_actions_indexs.append(idx)\n
\n
if existing_actions_indexs:\n
if existing_actions_indexs:\n
context.deleteActions(existing_actions_indexs)\n
else:\n
existing_actions_ids = []\n
for action in context.objectValues(spec=\'ERP5 Action Information\'):\n
if action.getReference() == id:\n
existing_actions_ids.append(action.getId())\n
if existing_actions_ids:\n
context.manage_delObjects(existing_actions_ids)\n
\n
return \'Set Successfully.\'\n
</string> </value>
......@@ -111,6 +119,8 @@ return \'Set Successfully.\'\n
<string>enumerate</string>
<string>idx</string>
<string>ai</string>
<string>existing_actions_ids</string>
<string>action</string>
</tuple>
</value>
</item>
......
498
\ No newline at end of file
499
\ 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