Repository: paperless-ngx/paperless-ngx

Issue:
[BUG] storage_path is missing in manifest.json
### Description

there is no "model": "documents.storage_path" in manifest.json. I found it only in db.sqlite

### Steps to reproduce

open export/manifest.json after `docker compose exec webserver document_exporter ../export -f`

### Webserver logs

_No response_

### Paperless-ngx version

1.8.0

### Host OS

Raspberry Pi 4/arm64

### Installation method

Docker - official image

### Browser

_No response_

### Configuration changes

_No response_

### Other

_No response_


Discussion:

Resolving patch:
diff --git a/src/documents/management/commands/document_exporter.py b/src/documents/management/commands/document_exporter.py
--- a/src/documents/management/commands/document_exporter.py
+++ b/src/documents/management/commands/document_exporter.py
@@ -18,6 +18,7 @@
 from documents.models import DocumentType
 from documents.models import SavedView
 from documents.models import SavedViewFilterRule
+from documents.models import StoragePath
 from documents.models import Tag
 from documents.models import UiSettings
 from documents.settings import EXPORTER_ARCHIVE_NAME
@@ -114,8 +115,8 @@ def dump(self, progress_bar_disable=False):
                 map(lambda f: os.path.abspath(os.path.join(root, f)), files),
             )
 
-        # 2. Create manifest, containing all correspondents, types, tags,
-        # documents and ui_settings
+        # 2. Create manifest, containing all correspondents, types, tags, storage paths
+        # comments, documents and ui_settings
         with transaction.atomic():
             manifest = json.loads(
                 serializers.serialize("json", Correspondent.objects.all()),
@@ -127,6 +128,10 @@ def dump(self, progress_bar_disable=False):
                 serializers.serialize("json", DocumentType.objects.all()),
             )
 
+            manifest += json.loads(
+                serializers.serialize("json", StoragePath.objects.all()),
+            )
+
             manifest += json.loads(
                 serializers.serialize("json", Comment.objects.all()),
             )


Test patch:
diff --git a/src/documents/tests/test_management_exporter.py b/src/documents/tests/test_management_exporter.py
--- a/src/documents/tests/test_management_exporter.py
+++ b/src/documents/tests/test_management_exporter.py
@@ -14,6 +14,7 @@
 from documents.models import Correspondent
 from documents.models import Document
 from documents.models import DocumentType
+from documents.models import StoragePath
 from documents.models import Tag
 from documents.models import User
 from documents.sanity_checker import check_sanity
@@ -70,11 +71,14 @@ def setUp(self) -> None:
         self.t1 = Tag.objects.create(name="t")
         self.dt1 = DocumentType.objects.create(name="dt")
         self.c1 = Correspondent.objects.create(name="c")
+        self.sp1 = StoragePath.objects.create(path="{created_year}-{title}")
 
         self.d1.tags.add(self.t1)
         self.d1.correspondent = self.c1
         self.d1.document_type = self.dt1
         self.d1.save()
+        self.d4.storage_path = self.sp1
+        self.d4.save()
         super().setUp()
 
     def _get_document_from_manifest(self, manifest, id):
@@ -120,7 +124,7 @@ def test_exporter(self, use_filename_format=False):
 
         manifest = self._do_export(use_filename_format=use_filename_format)
 
-        self.assertEqual(len(manifest), 10)
+        self.assertEqual(len(manifest), 11)
         self.assertEqual(
             len(list(filter(lambda e: e["model"] == "documents.document", manifest))),
             4,
@@ -199,6 +203,7 @@ def test_exporter(self, use_filename_format=False):
             self.assertEqual(Tag.objects.count(), 1)
             self.assertEqual(Correspondent.objects.count(), 1)
             self.assertEqual(DocumentType.objects.count(), 1)
+            self.assertEqual(StoragePath.objects.count(), 1)
             self.assertEqual(Document.objects.get(id=self.d1.id).title, "wow1")
             self.assertEqual(Document.objects.get(id=self.d2.id).title, "wow2")
             self.assertEqual(Document.objects.get(id=self.d3.id).title, "wow2")