From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:08:50 +0000 (-0700) Subject: Fix: trigger move and rename after custom fields saved (#7927) X-Git-Tag: v2.13.1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62922968766ff611a2e36229c701157c522d297b;p=thirdparty%2Fpaperless-ngx.git Fix: trigger move and rename after custom fields saved (#7927) --- diff --git a/src/documents/signals/handlers.py b/src/documents/signals/handlers.py index f18cf1c9bb..93d201e914 100644 --- a/src/documents/signals/handlers.py +++ b/src/documents/signals/handlers.py @@ -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.