mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-04 03:27:12 -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,
 | 
					            field=field,
 | 
				
			||||||
            document=document,
 | 
					            document=document,
 | 
				
			||||||
        ).first()
 | 
					        ).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:
 | 
					            for doc_id in current_field_instance.value:
 | 
				
			||||||
                if doc_id not in target_doc_ids:
 | 
					                if doc_id not in target_doc_ids:
 | 
				
			||||||
                    self.remove_doclink(document, field, doc_id)
 | 
					                    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
 | 
					        # Create an instance if target doc doesnt have this field or append it to an existing one
 | 
				
			||||||
        existing_custom_field_instances = {
 | 
					        existing_custom_field_instances = {
 | 
				
			||||||
            custom_field.document_id: custom_field
 | 
					            custom_field.document_id: custom_field
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user