@@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json | |||||
from .exceptions import * | from .exceptions import * | ||||
from .utils.jinja import get_jenv, get_template, render_template | from .utils.jinja import get_jenv, get_template, render_template | ||||
__version__ = "7.0.40" | |||||
__version__ = "7.0.41" | |||||
local = Local() | local = Local() | ||||
@@ -999,8 +999,12 @@ def execute_action(doctype, name, action, **kwargs): | |||||
getattr(doc, action)(**kwargs) | getattr(doc, action)(**kwargs) | ||||
except frappe.ValidationError: | except frappe.ValidationError: | ||||
# add a comment (?) | # add a comment (?) | ||||
doc.add_comment('Comment', | |||||
_('Action Failed') + '<br><br>' + json.loads(frappe.local.message_log[-1]).get('message')) | |||||
if frappe.local.message_log: | |||||
msg = json.loads(frappe.local.message_log[-1]).get('message') | |||||
else: | |||||
msg = '<pre><code>' + frappe.get_traceback() + '</pre></code>' | |||||
doc.add_comment('Comment', _('Action Failed') + '<br><br>' + msg) | |||||
doc.notify_update() | doc.notify_update() | ||||
except Exception: | except Exception: | ||||
@@ -363,8 +363,8 @@ def get_messages_from_workflow(doctype=None, app_name=None): | |||||
'select distinct message from `tabWorkflow Document State` where parent=%s and message is not null', | 'select distinct message from `tabWorkflow Document State` where parent=%s and message is not null', | ||||
(w['name'],), as_dict=True) | (w['name'],), as_dict=True) | ||||
messages.extend([("Workflow: " + w['name'], states['message']) | |||||
for state in states if is_translatable(state['state'])]) | |||||
messages.extend([("Workflow: " + w['name'], state['message']) | |||||
for state in states if is_translatable(state['message'])]) | |||||
actions = frappe.db.sql( | actions = frappe.db.sql( | ||||
'select distinct action from `tabWorkflow Transition` where parent=%s', | 'select distinct action from `tabWorkflow Transition` where parent=%s', | ||||