Fix: doc link removal before assigning value (#5451)

This commit is contained in:
shamoon 2024-01-18 06:58:41 -08:00 committed by GitHub
parent aa798604b3
commit 26900e0766
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -670,7 +670,10 @@ class DocumentSerializer(
for custom_field_instance in instance.custom_fields.filter(
field__data_type=CustomField.FieldDataType.DOCUMENTLINK,
):
if custom_field_instance.field not in incoming_custom_fields:
if (
custom_field_instance.field not in incoming_custom_fields
and custom_field_instance.value is not None
):
# Doc link field is being removed entirely
for doc_id in custom_field_instance.value:
CustomFieldInstanceSerializer.remove_doclink(