Fix: use hard delete for custom fields with workflow removal (#10191)

This commit is contained in:
shamoon 2025-06-16 07:09:22 -07:00 committed by GitHub
parent cbd9823ad6
commit 60ebdc0ad6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1021,7 +1021,7 @@ def run_workflows(
if action.remove_all_custom_fields: if action.remove_all_custom_fields:
if not use_overrides: if not use_overrides:
CustomFieldInstance.objects.filter(document=document).delete() CustomFieldInstance.objects.filter(document=document).hard_delete()
else: else:
overrides.custom_fields = None overrides.custom_fields = None
elif action.remove_custom_fields.exists(): elif action.remove_custom_fields.exists():
@ -1029,7 +1029,7 @@ def run_workflows(
CustomFieldInstance.objects.filter( CustomFieldInstance.objects.filter(
field__in=action.remove_custom_fields.all(), field__in=action.remove_custom_fields.all(),
document=document, document=document,
).delete() ).hard_delete()
elif overrides.custom_fields: elif overrides.custom_fields:
for field in action.remove_custom_fields.filter( for field in action.remove_custom_fields.filter(
pk__in=overrides.custom_fields.keys(), pk__in=overrides.custom_fields.keys(),