Create workflow action errors using the generic object error
namespace and not directly to the model. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -13,7 +13,7 @@ from common import (
|
||||
menu_setup, menu_sidebar, menu_tools
|
||||
)
|
||||
from common.classes import ErrorLogNamespace, ModelAttribute
|
||||
from common.links import link_error_list
|
||||
from common.links import link_object_error_list
|
||||
from common.widgets import two_state_template
|
||||
from mayan.celery import app
|
||||
from navigation import SourceColumn
|
||||
@@ -264,7 +264,7 @@ class DocumentStatesApp(MayanAppConfig):
|
||||
menu_object.bind_links(
|
||||
links=(
|
||||
link_setup_workflow_state_action_edit,
|
||||
link_error_list,
|
||||
link_object_error_list,
|
||||
link_setup_workflow_state_action_delete,
|
||||
), sources=(WorkflowStateAction,)
|
||||
)
|
||||
|
||||
9
mayan/apps/document_states/error_logs.py
Normal file
9
mayan/apps/document_states/error_logs.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.classes import ErrorLogNamespace
|
||||
|
||||
error_log_state_actions = ErrorLogNamespace(
|
||||
name='workflow_state_actions', label=_('Workflow state actions')
|
||||
)
|
||||
@@ -20,6 +20,7 @@ from documents.models import Document, DocumentType
|
||||
from events.models import EventType
|
||||
from permissions import Permission
|
||||
|
||||
from .error_logs import error_log_state_actions
|
||||
from .literals import (
|
||||
WORKFLOW_ACTION_WHEN_CHOICES, WORKFLOW_ACTION_ON_ENTRY,
|
||||
WORKFLOW_ACTION_ON_EXIT
|
||||
@@ -247,8 +248,10 @@ class WorkflowStateAction(models.Model):
|
||||
try:
|
||||
self.get_class_instance().execute(context=context)
|
||||
except Exception as exception:
|
||||
self.error_logs.create(
|
||||
result='{}; {}'.format(exception.__class__.__name__, exception)
|
||||
error_log_state_actions.create(
|
||||
obj=self, result='{}; {}'.format(
|
||||
exception.__class__.__name__, exception
|
||||
)
|
||||
)
|
||||
|
||||
if settings.DEBUG:
|
||||
|
||||
Reference in New Issue
Block a user