Files
mayan-edms/mayan/apps/document_states/handlers.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

23 lines
541 B
Python

from __future__ import unicode_literals
from django.apps import apps
from document_indexing.tasks import task_index_document
def launch_workflow(sender, instance, created, **kwargs):
Workflow = apps.get_model(
app_label='document_states', model_name='Workflow'
)
if created:
Workflow.objects.launch_for(instance)
def handler_index_document(sender, **kwargs):
task_index_document.apply_async(
kwargs=dict(
document_id=kwargs['instance'].workflow_instance.document.pk
)
)