mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-14 18:46:52 +01:00
Feature: consumption templates (#4196)
* Initial implementation of consumption templates * Frontend implementation of consumption templates Testing * Support consumption template source * order templates, automatically add permissions * Support title assignment in consumption templates * Refactoring, filters to and, show sources on list Show sources on template list, update some translation strings Make filters and minor testing * Update strings * Only update django-multiselectfield * Basic docs, document some methods * Improve testing coverage, template multi-assignment merges
This commit is contained in:
parent
86d223fd93
commit
9712ac109d
51 changed files with 3250 additions and 444 deletions
|
|
@ -436,6 +436,9 @@ class MailAccountHandler(LoggingMixin):
|
|||
elif rule.assign_title_from == MailRule.TitleSource.FROM_FILENAME:
|
||||
return os.path.splitext(os.path.basename(att.filename))[0]
|
||||
|
||||
elif rule.assign_title_from == MailRule.TitleSource.NONE:
|
||||
return None
|
||||
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
"Unknown title selector.",
|
||||
|
|
@ -690,6 +693,7 @@ class MailAccountHandler(LoggingMixin):
|
|||
input_doc = ConsumableDocument(
|
||||
source=DocumentSource.MailFetch,
|
||||
original_file=temp_filename,
|
||||
mailrule_id=rule.pk,
|
||||
)
|
||||
doc_overrides = DocumentMetadataOverrides(
|
||||
title=title,
|
||||
|
|
@ -697,7 +701,9 @@ class MailAccountHandler(LoggingMixin):
|
|||
correspondent_id=correspondent.id if correspondent else None,
|
||||
document_type_id=doc_type.id if doc_type else None,
|
||||
tag_ids=tag_ids,
|
||||
owner_id=rule.owner.id if rule.owner else None,
|
||||
owner_id=rule.owner.id
|
||||
if (rule.assign_owner_from_rule and rule.owner)
|
||||
else None,
|
||||
)
|
||||
|
||||
consume_task = consume_file.s(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue