]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: trigger move and rename after custom fields saved (#7927)
authorshamoon <4887959+shamoon@users.noreply.github.com>
Tue, 15 Oct 2024 17:08:50 +0000 (10:08 -0700)
committerGitHub <noreply@github.com>
Tue, 15 Oct 2024 17:08:50 +0000 (10:08 -0700)
src/documents/signals/handlers.py

index f18cf1c9bb23125d35fd1ab3877bc9d26975b844..93d201e914cac6d905cd8b00476533c4681073d2 100644 (file)
@@ -364,9 +364,17 @@ class CannotMoveFilesException(Exception):
     pass
 
 
+@receiver(models.signals.post_save, sender=CustomFieldInstance)
 @receiver(models.signals.m2m_changed, sender=Document.tags.through)
 @receiver(models.signals.post_save, sender=Document)
-def update_filename_and_move_files(sender, instance: Document, **kwargs):
+def update_filename_and_move_files(
+    sender,
+    instance: Document | CustomFieldInstance,
+    **kwargs,
+):
+    if isinstance(instance, CustomFieldInstance):
+        instance = instance.document
+
     def validate_move(instance, old_path, new_path):
         if not os.path.isfile(old_path):
             # Can't do anything if the old file does not exist anymore.