mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-01 11:19:32 -05:00
allow {filename} placeholder in workflow
This commit is contained in:
parent
d7d3fed833
commit
2022224e4b
@ -411,6 +411,7 @@ applied. You can use the following placeholders with any trigger type:
|
|||||||
- `{added_day}`: added day
|
- `{added_day}`: added day
|
||||||
- `{added_time}`: added time in HH:MM format
|
- `{added_time}`: added time in HH:MM format
|
||||||
- `{original_filename}`: original file name without extension
|
- `{original_filename}`: original file name without extension
|
||||||
|
- `{filename}`: current file name without extension
|
||||||
|
|
||||||
The following placeholders are only available for "added" or "updated" triggers
|
The following placeholders are only available for "added" or "updated" triggers
|
||||||
|
|
||||||
|
@ -673,6 +673,7 @@ class ConsumerPlugin(
|
|||||||
owner_username,
|
owner_username,
|
||||||
local_added,
|
local_added,
|
||||||
self.filename,
|
self.filename,
|
||||||
|
self.filename,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _store(
|
def _store(
|
||||||
|
@ -1864,6 +1864,7 @@ class WorkflowActionSerializer(serializers.ModelSerializer):
|
|||||||
added_time="",
|
added_time="",
|
||||||
owner_username="",
|
owner_username="",
|
||||||
original_filename="",
|
original_filename="",
|
||||||
|
filename="",
|
||||||
created="",
|
created="",
|
||||||
created_year="",
|
created_year="",
|
||||||
created_year_short="",
|
created_year_short="",
|
||||||
|
@ -615,6 +615,7 @@ def run_workflows(
|
|||||||
document.owner.username if document.owner else "",
|
document.owner.username if document.owner else "",
|
||||||
timezone.localtime(document.added),
|
timezone.localtime(document.added),
|
||||||
document.original_filename or "",
|
document.original_filename or "",
|
||||||
|
document.filename or "",
|
||||||
timezone.localtime(document.created),
|
timezone.localtime(document.created),
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -9,6 +9,7 @@ def parse_doc_title_w_placeholders(
|
|||||||
owner_username: str,
|
owner_username: str,
|
||||||
local_added: datetime,
|
local_added: datetime,
|
||||||
original_filename: str,
|
original_filename: str,
|
||||||
|
filename: str,
|
||||||
created: datetime | None = None,
|
created: datetime | None = None,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""
|
"""
|
||||||
@ -29,6 +30,7 @@ def parse_doc_title_w_placeholders(
|
|||||||
"added_time": local_added.strftime("%H:%M"),
|
"added_time": local_added.strftime("%H:%M"),
|
||||||
"owner_username": owner_username,
|
"owner_username": owner_username,
|
||||||
"original_filename": Path(original_filename).stem,
|
"original_filename": Path(original_filename).stem,
|
||||||
|
"filename": Path(filename).stem,
|
||||||
}
|
}
|
||||||
if created is not None:
|
if created is not None:
|
||||||
formatting.update(
|
formatting.update(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user