Compare commits

..
1 Commits
Author SHA1 Message Date
shamoon 47562449f4 Fix: ensure apply ai suggestions runs after document created 2026-09-02 08:58:45 -07:00
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -1003,7 +1003,7 @@ def run_workflows(
# kwargs so the PaperlessTask record can note the # kwargs so the PaperlessTask record can note the
# document, see _extract_input_data # document, see _extract_input_data
apply_ai_suggestions.delay( apply_ai_suggestions.delay_on_commit(
action_id=action.pk, action_id=action.pk,
document_id=document.pk, document_id=document.pk,
) )
+5 -1
View File
@@ -5621,11 +5621,15 @@ class TestApplyAISuggestionsWorkflowAction(
action = self.make_action() action = self.make_action()
self.make_workflow(action, WorkflowTrigger.WorkflowTriggerType.DOCUMENT_ADDED) 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( run_workflows(
WorkflowTrigger.WorkflowTriggerType.DOCUMENT_ADDED, WorkflowTrigger.WorkflowTriggerType.DOCUMENT_ADDED,
self.doc, self.doc,
) )
delay.assert_not_called()
delay.assert_called_once_with(action_id=action.pk, document_id=self.doc.pk) delay.assert_called_once_with(action_id=action.pk, document_id=self.doc.pk)