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 @@ ...@@ -55,7 +55,7 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""Add or replace an action on a type informations from types tool.\n <value> <string>"""Add or replace an action on a type informations from types tool.\n
"""\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 \n
context.PortalType_deleteAction(id=id)\n context.PortalType_deleteAction(id=id)\n
\n \n
...@@ -66,6 +66,7 @@ context.addAction( id = id\n ...@@ -66,6 +66,7 @@ context.addAction( id = id\n
, permission = permission\n , permission = permission\n
, category = category\n , category = category\n
, icon = icon\n , icon = icon\n
, priority = 10.0\n
)\n )\n
\n \n
return \'Set Successfully.\'\n return \'Set Successfully.\'\n
......
...@@ -55,15 +55,23 @@ ...@@ -55,15 +55,23 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""Delete an action on a type informations from types tool.\n <value> <string>"""Delete an action on a type informations from types tool.\n
"""\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 \n
existing_actions_indexs = []\n if context.meta_type == \'ERP5 Type Information\':\n
for idx, ai in enumerate(context.listActions()):\n existing_actions_indexs = []\n
for idx, ai in enumerate(context.listActions()):\n
if ai.getId() == id:\n if ai.getId() == id:\n
existing_actions_indexs.append(idx)\n existing_actions_indexs.append(idx)\n
\n \n
if existing_actions_indexs:\n if existing_actions_indexs:\n
context.deleteActions(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 \n
return \'Set Successfully.\'\n return \'Set Successfully.\'\n
</string> </value> </string> </value>
...@@ -111,6 +119,8 @@ return \'Set Successfully.\'\n ...@@ -111,6 +119,8 @@ return \'Set Successfully.\'\n
<string>enumerate</string> <string>enumerate</string>
<string>idx</string> <string>idx</string>
<string>ai</string> <string>ai</string>
<string>existing_actions_ids</string>
<string>action</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
498 499
\ No newline at end of file \ 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