Commit 580ac1f4 authored by Romain Courteaud's avatar Romain Courteaud

erp5_hal_json_style: fixup error displayed when the delete transition can not be triggered

parent 0da9294b
...@@ -5,7 +5,7 @@ The code is a modified version of Folder_delete. We split into two files not to ...@@ -5,7 +5,7 @@ The code is a modified version of Folder_delete. We split into two files not to
further complicate the mentioned script. further complicate the mentioned script.
""" """
from ZODB.POSException import ConflictError from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
portal = context.getPortalObject() portal = context.getPortalObject()
translate = portal.Base_translateString translate = portal.Base_translateString
...@@ -31,13 +31,15 @@ if context.isDeletable(check_relation=True): ...@@ -31,13 +31,15 @@ if context.isDeletable(check_relation=True):
"portal_status_message": translate("Document deleted") "portal_status_message": translate("Document deleted")
}) })
except ConflictError: except UnsupportedWorkflowMethod:
raise
except Exception:
# XXX Catch-them-all expression is never a good idea
pass pass
request = portal.REQUEST request = portal.REQUEST
request.RESPONSE.setStatus(400) request.RESPONSE.setStatus(400)
form = getattr(context,form_id) return context.Base_renderForm(
return context.ERP5Document_getHateoas(form=form, REQUEST=request, mode='form') dialog_id,
keep_items={
'portal_status_message': translate("You are not authorised to delete the document"),
'portal_status_level': 'warning'
}
)
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