Remove all running workflow instances from documents whose type is removed from the workflow type. This avoid having orphaned workflows running.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -140,6 +140,9 @@
|
||||
- Fix issue when using workflows transitions with the new version
|
||||
upload event as trigger. Thanks to Sema @Miggaten for the find and
|
||||
the solution.
|
||||
- Removing running workflow instances in document of a specific type if
|
||||
that document type is removed from the workflow.
|
||||
|
||||
|
||||
2.7.3 (2017-09-11)
|
||||
==================
|
||||
|
||||
@@ -325,6 +325,10 @@ allows apps to specify their own dependencies. These dependecies are then
|
||||
downloaded when the project is installed or upgraded. As such they are not
|
||||
part of the repository and lower the file size of the project.
|
||||
|
||||
Workflow changes
|
||||
----------------
|
||||
Removing a document type from a workflow will now also remove all running
|
||||
instances of that workflow for documents of the document type just removed.
|
||||
|
||||
Other changes worth mentioning
|
||||
------------------------------
|
||||
@@ -340,7 +344,8 @@ Other changes worth mentioning
|
||||
- Update to the latest version the packages for building, development, documentation and testing.
|
||||
- Add statistics script to produce a report of the views, APIs and test for each app.
|
||||
- Merge base64 filename patch from Cornelius Ludmann.
|
||||
- SearchModel return interface changed. The class no longer returns the result_set value. Use the queryset returned instead.
|
||||
- SearchModel return interface changed. The class no longer
|
||||
returns the result_set value. Use the queryset returned instead.
|
||||
- Remove the unused scrollable_content internal feature.
|
||||
- Remove unused animate.css package.
|
||||
- Add the MERC specifying javascript library usage.
|
||||
|
||||
@@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.contrib import messages
|
||||
from django.core.files.base import ContentFile
|
||||
from django.db import transaction
|
||||
from django.db.utils import IntegrityError
|
||||
from django.http import Http404, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
@@ -176,6 +177,17 @@ class SetupWorkflowDocumentTypesView(AssignRemoveView):
|
||||
# TODO: add task launching this workflow for all the document types
|
||||
# of item
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
messages.warning(
|
||||
self.request, _(
|
||||
'Removing a document type from a workflow will also '
|
||||
'remove all running instances of that workflow for '
|
||||
'documents of the document type just removed.'
|
||||
)
|
||||
)
|
||||
|
||||
return super(SetupWorkflowDocumentTypesView, self).dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_extra_context(self):
|
||||
return {
|
||||
'title': _(
|
||||
@@ -198,9 +210,11 @@ class SetupWorkflowDocumentTypesView(AssignRemoveView):
|
||||
)
|
||||
|
||||
def remove(self, item):
|
||||
self.get_object().document_types.remove(item)
|
||||
# TODO: add task deleting this workflow for all the document types of
|
||||
# item
|
||||
# When removing a document type to workflow association
|
||||
# also remove all running workflows in documents of that type.
|
||||
with transaction.atomic():
|
||||
self.get_object().document_types.remove(item)
|
||||
self.get_object().instances.filter(document__document_type=item).delete()
|
||||
|
||||
|
||||
# Workflow state actions
|
||||
|
||||
Reference in New Issue
Block a user