From 076446573ea42e36e8def1e86639b4abec96df7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 5 Oct 2008 23:24:23 +0200 Subject: [PATCH] Use raise_user_error for exception about deleteing workflow record for issue413 --- trytond/ir/translation.xml | 9 +++++++++ trytond/osv/orm.py | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/trytond/ir/translation.xml b/trytond/ir/translation.xml index edde03c466..42cf666ddb 100644 --- a/trytond/ir/translation.xml +++ b/trytond/ir/translation.xml @@ -95,6 +95,15 @@ ir + + delete_workflow_record + en_US + error + You cannot delete a record with a running workflow. + You cannot delete a record with a running workflow. + ir + + ir.translation.set_report.init diff --git a/trytond/osv/orm.py b/trytond/osv/orm.py index 19f65c9e15..e40dba42f6 100644 --- a/trytond/osv/orm.py +++ b/trytond/osv/orm.py @@ -1406,8 +1406,8 @@ class ORM(object): "AND res_type = %s AND state != 'complete'", ids + [self._name]) if cursor.rowcount != 0: - raise Exception('UserError', - 'You cannot delete a record with a running workflow.') + self.raise_user_error(cursor, 'delete_workflow_record', + context=context) wf_service = LocalService("workflow") for obj_id in ids: