Repository: paperless-ngx/paperless-ngx

Issue:
[BUG] Storage path does not accept year/month variants despite the doc says so
### Description

Using the year/month placeholder variants to create storage paths fails with 400 Bad Request.

These year/month variants were introduced in #1906 but only seem to work as the global `PAPERLESS_FILENAME_FORMAT` setting, but not as part of a storage path.

![Screenshot 2023-02-11 at 9 45 10 PM](https://user-images.githubusercontent.com/24447831/218295883-3fca4f59-cb1e-4571-8433-91b995fd3ecc.png)


Not sure if this should be tagged as `bug` or `enhancement`,  but the doc saying

> Each storage path is a `PAPERLESS_FILENAME_FORMAT`

throws me off a bit when I realized that some placeholders don't actually work with storage paths.

### Steps to reproduce

1. Create a storage path
2. Set the path using `created_year_short`/`created_month_name_short`
3. Click save
4. See `Invalid variable detected.` error message

### Webserver logs

```bash
[2023-02-11 21:56:31,746] [WARNING] [django.request] Bad Request: /api/storage_paths/13/
```


### Browser logs

_No response_

### Paperless-ngx version

1.12.2

### Host OS

Ubuntu

### Installation method

Docker - official image

### Browser

_No response_

### Configuration changes

_No response_

### Other

_No response_


Discussion:

Resolving patch:
diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py
--- a/src/documents/serialisers.py
+++ b/src/documents/serialisers.py
@@ -599,11 +599,17 @@ def validate_path(self, path):
                 document_type="document_type",
                 created="created",
                 created_year="created_year",
+                created_year_short="created_year_short",
                 created_month="created_month",
+                created_month_name="created_month_name",
+                created_month_name_short="created_month_name_short",
                 created_day="created_day",
                 added="added",
                 added_year="added_year",
+                added_year_short="added_year_short",
                 added_month="added_month",
+                added_month_name="added_month_name",
+                added_month_name_short="added_month_name_short",
                 added_day="added_day",
                 asn="asn",
                 tags="tags",


Test patch:
diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.py
--- a/src/documents/tests/test_api.py
+++ b/src/documents/tests/test_api.py
@@ -3199,6 +3199,30 @@ def test_api_create_invalid_storage_path(self):
         self.assertEqual(response.status_code, 400)
         self.assertEqual(StoragePath.objects.count(), 1)
 
+    def test_api_storage_path_placeholders(self):
+        """
+        GIVEN:
+            - API request to create a storage path with placeholders
+            - Storage path is valid
+        WHEN:
+            - API is called
+        THEN:
+            - Correct HTTP response
+            - New storage path is created
+        """
+        response = self.client.post(
+            self.ENDPOINT,
+            json.dumps(
+                {
+                    "name": "Storage path with placeholders",
+                    "path": "{title}/{correspondent}/{document_type}/{created}/{created_year}/{created_year_short}/{created_month}/{created_month_name}/{created_month_name_short}/{created_day}/{added}/{added_year}/{added_year_short}/{added_month}/{added_month_name}/{added_month_name_short}/{added_day}/{asn}/{tags}/{tag_list}/",
+                },
+            ),
+            content_type="application/json",
+        )
+        self.assertEqual(response.status_code, 201)
+        self.assertEqual(StoragePath.objects.count(), 2)
+
 
 class TestTasks(DirectoriesMixin, APITestCase):
     ENDPOINT = "/api/tasks/"