mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	Fix saving doc links with no value (#5144)
This commit is contained in:
		
							parent
							
								
									fbeb03c377
								
							
						
					
					
						commit
						76001105b8
					
				@ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user