mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Merge branch 'dev' into main
This commit is contained in:
commit
370f6ddb3b
@ -35,7 +35,7 @@
|
||||
(clear)="clearLastSearchTerm()"
|
||||
(blur)="onBlur()">
|
||||
<ng-template ng-option-tmp let-item="item">
|
||||
<span [title]="item.name">{{item.name}}</span>
|
||||
<span [title]="item[bindLabel]">{{item[bindLabel]}}</span>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
@if (allowCreateNew) {
|
||||
|
@ -5,7 +5,7 @@ export const environment = {
|
||||
apiBaseUrl: document.baseURI + 'api/',
|
||||
apiVersion: '3',
|
||||
appTitle: 'Paperless-ngx',
|
||||
version: '2.2.0',
|
||||
version: '2.2.0-dev',
|
||||
webSocketHost: window.location.host,
|
||||
webSocketProtocol: window.location.protocol == 'https:' ? 'wss:' : 'ws:',
|
||||
webSocketBaseUrl: base_url.pathname + 'ws/',
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -55,31 +55,37 @@ class DocumentMetadataOverrides:
|
||||
self.tag_ids = other.tag_ids
|
||||
elif other.tag_ids is not None:
|
||||
self.tag_ids.extend(other.tag_ids)
|
||||
self.tag_ids = list(set(self.tag_ids))
|
||||
|
||||
if self.view_users is None:
|
||||
self.view_users = other.view_users
|
||||
elif other.view_users is not None:
|
||||
self.view_users.extend(other.view_users)
|
||||
self.view_users = list(set(self.view_users))
|
||||
|
||||
if self.view_groups is None:
|
||||
self.view_groups = other.view_groups
|
||||
elif other.view_groups is not None:
|
||||
self.view_groups.extend(other.view_groups)
|
||||
self.view_groups = list(set(self.view_groups))
|
||||
|
||||
if self.change_users is None:
|
||||
self.change_users = other.change_users
|
||||
elif other.change_users is not None:
|
||||
self.change_users.extend(other.change_users)
|
||||
self.change_users = list(set(self.change_users))
|
||||
|
||||
if self.change_groups is None:
|
||||
self.change_groups = other.change_groups
|
||||
elif other.change_groups is not None:
|
||||
self.change_groups.extend(other.change_groups)
|
||||
self.change_groups = list(set(self.change_groups))
|
||||
|
||||
if self.custom_field_ids is None:
|
||||
self.custom_field_ids = other.custom_field_ids
|
||||
elif other.custom_field_ids is not None:
|
||||
self.custom_field_ids.extend(other.custom_field_ids)
|
||||
self.custom_field_ids = list(set(self.custom_field_ids))
|
||||
|
||||
return self
|
||||
|
||||
|
@ -512,11 +512,17 @@ class CustomFieldInstanceSerializer(serializers.ModelSerializer):
|
||||
field=field,
|
||||
document=document,
|
||||
).first()
|
||||
if current_field_instance is not None:
|
||||
if (
|
||||
current_field_instance is not None
|
||||
and current_field_instance.value is not None
|
||||
):
|
||||
for doc_id in current_field_instance.value:
|
||||
if doc_id not in target_doc_ids:
|
||||
self.remove_doclink(document, field, doc_id)
|
||||
|
||||
if target_doc_ids is None:
|
||||
target_doc_ids = []
|
||||
|
||||
# Create an instance if target doc doesnt have this field or append it to an existing one
|
||||
existing_custom_field_instances = {
|
||||
custom_field.document_id: custom_field
|
||||
|
@ -486,3 +486,54 @@ class TestConsumptionTemplates(DirectoriesMixin, FileSystemAssertsMixin, TestCas
|
||||
self.assertIn(expected_str, cm.output[0])
|
||||
expected_str = f"Document source {DocumentSource.ApiUpload.name} not in ['{DocumentSource.ConsumeFolder.name}', '{DocumentSource.MailFetch.name}']"
|
||||
self.assertIn(expected_str, cm.output[1])
|
||||
|
||||
@mock.patch("documents.consumer.Consumer.try_consume_file")
|
||||
def test_consumption_template_repeat_custom_fields(self, m):
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing consumption templates which assign the same custom field
|
||||
WHEN:
|
||||
- File that matches is consumed
|
||||
THEN:
|
||||
- Custom field is added the first time successfully
|
||||
"""
|
||||
ct = ConsumptionTemplate.objects.create(
|
||||
name="Template 1",
|
||||
order=0,
|
||||
sources=f"{DocumentSource.ApiUpload},{DocumentSource.ConsumeFolder},{DocumentSource.MailFetch}",
|
||||
filter_filename="*simple*",
|
||||
)
|
||||
ct.assign_custom_fields.add(self.cf1.pk)
|
||||
ct.save()
|
||||
|
||||
ct2 = ConsumptionTemplate.objects.create(
|
||||
name="Template 2",
|
||||
order=1,
|
||||
sources=f"{DocumentSource.ApiUpload},{DocumentSource.ConsumeFolder},{DocumentSource.MailFetch}",
|
||||
filter_filename="*simple*",
|
||||
)
|
||||
ct2.assign_custom_fields.add(self.cf1.pk)
|
||||
ct2.save()
|
||||
|
||||
test_file = self.SAMPLE_DIR / "simple.pdf"
|
||||
|
||||
with mock.patch("documents.tasks.async_to_sync"):
|
||||
with self.assertLogs("paperless.matching", level="INFO") as cm:
|
||||
tasks.consume_file(
|
||||
ConsumableDocument(
|
||||
source=DocumentSource.ConsumeFolder,
|
||||
original_file=test_file,
|
||||
),
|
||||
None,
|
||||
)
|
||||
m.assert_called_once()
|
||||
_, overrides = m.call_args
|
||||
self.assertEqual(
|
||||
overrides["override_custom_field_ids"],
|
||||
[self.cf1.pk],
|
||||
)
|
||||
|
||||
expected_str = f"Document matched template {ct}"
|
||||
self.assertIn(expected_str, cm.output[0])
|
||||
expected_str = f"Document matched template {ct2}"
|
||||
self.assertIn(expected_str, cm.output[1])
|
||||
|
@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: paperless-ngx\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-12-09 10:53-0800\n"
|
||||
"PO-Revision-Date: 2023-12-28 00:23\n"
|
||||
"PO-Revision-Date: 2023-12-28 12:09\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Polish\n"
|
||||
"Language: pl_PL\n"
|
||||
|
@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: paperless-ngx\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-12-09 10:53-0800\n"
|
||||
"PO-Revision-Date: 2023-12-27 12:08\n"
|
||||
"PO-Revision-Date: 2023-12-28 12:09\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Chinese Simplified\n"
|
||||
"Language: zh_CN\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user