Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Merge branch 'main' into dev

shamoon48cd1cce6ab8
diff --cc pyproject.toml
index 1240805e5,ae95894c8..a62ad51fa
--- a/pyproject.toml
+++ b/pyproject.toml
@@@ -1,11 -1,12 +1,11 @@@
[project]
name = "paperless-ngx"
- version = "2.20.10"
+ version = "2.20.11"
description = "A community-supported supercharged document management system: scan, index and archive all your physical documents"
readme = "README.md"
-requires-python = ">=3.10"
+requires-python = ">=3.11"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
- "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
diff --cc src-ui/src/environments/environment.prod.ts
index a5bf6942f,bafd0dfab..1e8adbc22
--- a/src-ui/src/environments/environment.prod.ts
+++ b/src-ui/src/environments/environment.prod.ts
@@@ -3,10 -3,10 +3,10 @@@ const base_url = new URL(document.baseU
export const environment = {
production: true,
apiBaseUrl: document.baseURI + 'api/',
- apiVersion: '9', // match src/paperless/settings.py
+ apiVersion: '10', // match src/paperless/settings.py
appTitle: 'Paperless-ngx',
tag: 'prod',
- version: '2.20.10',
+ version: '2.20.11',
webSocketHost: window.location.host,
webSocketProtocol: window.location.protocol == 'https:' ? 'wss:' : 'ws:',
webSocketBaseUrl: base_url.pathname + 'ws/',
diff --cc src/documents/tests/test_workflows.py
index 78d42437d,ba1e72e1f..453a53341
--- a/src/documents/tests/test_workflows.py
+++ b/src/documents/tests/test_workflows.py
@@@ -905,7 -899,64 +906,64 @@@ class TestWorkflows
expected_str = f"Document matched {trigger} from {w}"
self.assertIn(expected_str, cm.output[0])
+ def test_workflow_assign_custom_field_keeps_storage_filename_in_sync(self) -> None:
+ """
+ GIVEN:
+ - Existing document with a storage path template that depends on a custom field
+ - Existing workflow triggered on document update assigning that custom field
+ WHEN:
+ - Workflow runs for the document
+ THEN:
+ - The database filename remains aligned with the moved file on disk
+ """
+ storage_path = StoragePath.objects.create(
+ name="workflow-custom-field-path",
+ path="{{ custom_fields|get_cf_value('Custom Field 1', 'none') }}/{{ title }}",
+ )
+ doc = Document.objects.create(
+ title="workflow custom field sync",
+ mime_type="application/pdf",
+ checksum="workflow-custom-field-sync",
+ storage_path=storage_path,
+ original_filename="workflow-custom-field-sync.pdf",
+ )
+ CustomFieldInstance.objects.create(
+ document=doc,
+ field=self.cf1,
+ value_text="initial",
+ )
+
+ generated = generate_unique_filename(doc)
+ destination = (settings.ORIGINALS_DIR / generated).resolve()
+ create_source_path_directory(destination)
+ shutil.copy(self.SAMPLE_DIR / "simple.pdf", destination)
+ Document.objects.filter(pk=doc.pk).update(filename=generated.as_posix())
+ doc.refresh_from_db()
+
+ trigger = WorkflowTrigger.objects.create(
+ type=WorkflowTrigger.WorkflowTriggerType.DOCUMENT_UPDATED,
+ )
+ action = WorkflowAction.objects.create(
+ type=WorkflowAction.WorkflowActionType.ASSIGNMENT,
+ assign_custom_fields_values={self.cf1.pk: "cars"},
+ )
+ action.assign_custom_fields.add(self.cf1.pk)
+ workflow = Workflow.objects.create(
+ name="Workflow custom field filename sync",
+ order=0,
+ )
+ workflow.triggers.add(trigger)
+ workflow.actions.add(action)
+ workflow.save()
+
+ run_workflows(WorkflowTrigger.WorkflowTriggerType.DOCUMENT_UPDATED, doc)
+
+ doc.refresh_from_db()
+ expected_filename = generate_filename(doc)
+ self.assertEqual(Path(doc.filename), expected_filename)
+ self.assertTrue(doc.source_path.is_file())
+
- def test_document_added_workflow(self):
+ def test_document_added_workflow(self) -> None:
trigger = WorkflowTrigger.objects.create(
type=WorkflowTrigger.WorkflowTriggerType.DOCUMENT_ADDED,
filter_filename="*sample*",
diff --cc uv.lock
index cc2c24e98,3e2b7d5cb..9d66db770
--- a/uv.lock
+++ b/uv.lock
@@@ -2849,10 -1991,9 +2849,10 @@@ wheels =
[[package]]
name = "paperless-ngx"
- version = "2.20.10"
+ version = "2.20.11"
source = { virtual = "." }
dependencies = [
+ { name = "azure-ai-documentintelligence", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "babel", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "bleach", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "celery", extra = ["redis"], marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },