mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-10 00:35:30 +01:00
Fix saving doc links with no value (#5144)
This commit is contained in:
parent
fbeb03c377
commit
76001105b8
1 changed files with 7 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue