From c0abacee87c5b9ec4737a53e3ac971f661f9e028 Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Wed, 4 Nov 2026 20:09:46 -0800 Subject: [PATCH] Fix: rename only root documents in document_renamer --- src/documents/management/commands/document_renamer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/documents/management/commands/document_renamer.py b/src/documents/management/commands/document_renamer.py index b91c8f8f79..b233188735 100644 --- a/src/documents/management/commands/document_renamer.py +++ b/src/documents/management/commands/document_renamer.py @@ -11,7 +11,8 @@ class Command(PaperlessCommand): def handle(self, *args, **options): for document in self.track( - Document.objects.only("pk"), + # move_files_for_document handles a root's versions itself + Document.objects.filter(root_document__isnull=True).only("pk"), description="Renaming...", ): move_files_for_document(document.pk)