diff --git a/src/documents/bulk_edit.py b/src/documents/bulk_edit.py index 119484a4d..5908b55c8 100644 --- a/src/documents/bulk_edit.py +++ b/src/documents/bulk_edit.py @@ -8,7 +8,6 @@ from documents.models import StoragePath from documents.permissions import set_permissions_for_object from documents.tasks import bulk_update_documents from documents.tasks import update_document_archive_file -from documents.tasks import update_owner_for_object def set_correspondent(doc_ids, correspondent): @@ -136,7 +135,7 @@ def set_permissions(doc_ids, set_permissions, owner=None): qs = Document.objects.filter(id__in=doc_ids) - update_owner_for_object.delay(document_ids=doc_ids, owner=owner) + qs.update(owner=owner) for doc in qs: set_permissions_for_object(set_permissions, doc) diff --git a/src/documents/tasks.py b/src/documents/tasks.py index 403025d08..fbc754e52 100644 --- a/src/documents/tasks.py +++ b/src/documents/tasks.py @@ -13,7 +13,6 @@ from asgiref.sync import async_to_sync from celery import shared_task from channels.layers import get_channel_layer from django.conf import settings -from django.contrib.auth.models import User from django.db import transaction from django.db.models.signals import post_save from documents import barcodes @@ -312,12 +311,3 @@ def update_document_archive_file(document_id): ) finally: parser.cleanup() - - -@shared_task -def update_owner_for_object(document_ids, owner): - documents = Document.objects.filter(id__in=document_ids) - ownerUser = User.objects.get(pk=owner) if owner is not None else None - for document in documents: - document.owner = ownerUser if owner is not None else None - document.save()