Commit 7f7e0f71 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

delete removed workflows from the workflow chain in WorkflowTemplateItem.uninstall().


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33622 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 40246311
......@@ -1654,6 +1654,21 @@ class WorkflowTemplateItem(ObjectTemplateItem):
else:
ObjectTemplateItem.install(self, context, trashbin, **kw)
def uninstall(self, context, **kw):
object_path = kw.get('object_path', None)
if object_path is not None:
object_keys = [object_path]
else:
object_keys = self._archive.keys()
removed_workflow_id_list = set([x.split('/', 1)[1] for x in object_keys])
(default_chain, chain_dict) = getChainByType(context)
for portal_type, workflow_ids in chain_dict.iteritems():
workflow_ids = set([x.strip() for x in workflow_ids.split(',')]) - \
removed_workflow_id_list
chain_dict[portal_type] = ', '.join(workflow_ids)
context.portal_workflow.manage_changeWorkflows(default_chain,
props=chain_dict)
ObjectTemplateItem.uninstall(self, context, **kw)
class PortalTypeTemplateItem(ObjectTemplateItem):
......
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