Commit bc212c6a authored by Georgios Dagkakis's avatar Georgios Dagkakis

erp5_core: Fixups in edit comment set to Folder within Folder_delete

- Use Message, so the comment is translated in display time
- Do edit only if we have some objects deleted from ZODB
parent aee05d0c
...@@ -15,6 +15,7 @@ the selection. ...@@ -15,6 +15,7 @@ the selection.
""" """
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from Products.CMFCore.WorkflowCore import WorkflowException from Products.CMFCore.WorkflowCore import WorkflowException
from Products.ERP5Type.Message import Message
portal = context.getPortalObject() portal = context.getPortalObject()
Base_translateString = portal.Base_translateString Base_translateString = portal.Base_translateString
...@@ -82,14 +83,19 @@ except ConflictError: ...@@ -82,14 +83,19 @@ except ConflictError:
except Exception as error: except Exception as error:
return context.Base_renderMessage(str(error), "error") return context.Base_renderMessage(str(error), "error")
object_ids = [x.getId() for x in object_to_remove_list] if object_to_remove_list:
comment = Base_translateString('Deleted objects: ${object_ids}', try:
mapping={'object_ids': object_ids})
try:
# record object deletion in workflow history # record object deletion in workflow history
portal.portal_workflow.doActionFor(context, 'edit_action', portal.portal_workflow.doActionFor(
comment=comment) context,
except WorkflowException: 'edit_action',
comment=Message(
domain='ui',
message='Deleted objects: ${object_ids}',
mapping={'object_ids': [x.getId() for x in object_to_remove_list]},
),
)
except WorkflowException:
# no 'edit_action' transition for this container # no 'edit_action' transition for this container
pass pass
......
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