A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix: ensure apply ai suggestions always runs after document created (#13940)
shamoonc5765a50a185
diff --git a/src/documents/signals/handlers.py b/src/documents/signals/handlers.pyindex b76759781..2e820c2b8 100644--- a/src/documents/signals/handlers.py+++ b/src/documents/signals/handlers.py@@ -1003,7 +1003,7 @@ def run_workflows(# kwargs so the PaperlessTask record can note the# document, see _extract_input_data- apply_ai_suggestions.delay(+ apply_ai_suggestions.delay_on_commit(action_id=action.pk,document_id=document.pk,)diff --git a/src/documents/tests/test_workflows.py b/src/documents/tests/test_workflows.pyindex 5c5ff548f..6376f6fc9 100644--- a/src/documents/tests/test_workflows.py+++ b/src/documents/tests/test_workflows.py@@ -5621,11 +5621,15 @@ class TestApplyAISuggestionsWorkflowAction(action = self.make_action()self.make_workflow(action, WorkflowTrigger.WorkflowTriggerType.DOCUMENT_ADDED)- with mock.patch("documents.tasks.apply_ai_suggestions.delay") as delay:+ with (+ mock.patch("documents.tasks.apply_ai_suggestions.delay") as delay,+ self.captureOnCommitCallbacks(execute=True),+ ):run_workflows(WorkflowTrigger.WorkflowTriggerType.DOCUMENT_ADDED,self.doc,)+ delay.assert_not_called()delay.assert_called_once_with(action_id=action.pk, document_id=self.doc.pk)