Files
mayan-edms/mayan/apps/document_states/tasks.py
Roberto Rosario 5798cabd7c Add support to update the document indexes from workflow state changes.
Add a new workflow field called internal_name for easier workflow
reference in document index templates.
Generalize the PropertyHelper class.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-06-06 20:07:15 -04:00

25 lines
661 B
Python

from __future__ import unicode_literals
import logging
from django.apps import apps
from mayan.celery import app
logger = logging.getLogger(__name__)
@app.task(ignore_result=True)
def task_launch_all_workflows():
Document = apps.get_model(app_label='documents', model_name='Document')
Workflow = apps.get_model(
app_label='document_states', model_name='Workflow'
)
logger.info('Start launching workflows')
for document in Document.objects.all():
logger.debug('Lauching workflows for document ID: %d', document.pk)
Workflow.objects.launch_for(document=document)
logger.info('Finished launching workflows')