From 196047a3e7418e035dd11f5e2ece2971f996c6f2 Mon Sep 17 00:00:00 2001 From: Yusei Tahara <yusei@nexedi.com> Date: Tue, 16 Oct 2012 10:15:07 +0900 Subject: [PATCH] Improve error handling on Workflow_statusModify. If requested transition is not available, then show a nice message. --- .../erp5_xhtml_style/Workflow_statusModify.xml | 7 +++++++ product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log | 3 +++ product/ERP5/bootstrap/erp5_xhtml_style/bt/revision | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.xml index 8fb7f6ae27..26a9c4d400 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.xml +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.xml @@ -52,6 +52,7 @@ <key> <string>_body</string> </key> <value> <string encoding="cdata"><![CDATA[ +from Products.CMFCore.WorkflowCore import WorkflowException\n from Products.Formulator.Errors import FormValidationError\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.ERP5Type.Message import translateString\n @@ -118,6 +119,12 @@ except ValidationFailed, error_message:\n # that would become an error.\n log("Status message has been truncated")\n message = "%s ..." % message[:(2000 - 4)]\n +except WorkflowException, error_message:\n + if str(error_message) == "No workflow provides the \'${action_id}\' action.":\n + message = translateString("Workflow state may have been updated by other user. Please try again.")\n + return context.Base_redirect(form_id, keep_items={\'portal_status_message\': message}, **kw)\n + else:\n + raise\n else:\n message = request.get(\'portal_status_message\')\n if message is None:\n diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log b/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log index cdde4dc95c..5adc017b09 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log @@ -1,3 +1,6 @@ +2012-10-16 yusei +* Improve error handling on Workflow_statusModify. If requested transition is not available, then show a nice message. + 2012-9-12 yusei * Improve listbox sort feature. Now both ascending arrow and descending arrow are displayed in title column and user can sort in specific order explicitly. User also can sort multiple columns by click without using sort-on-dialog. diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision index dfc8356d74..39987d0011 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision @@ -1 +1 @@ -1098 \ No newline at end of file +1099 \ No newline at end of file -- 2.30.9