mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
Fix: workflow assignment of customfield fails if field exists in v2.3.1 (#5302)
This commit is contained in:
@@ -610,10 +610,18 @@ def run_workflow(
|
||||
|
||||
if action.assign_custom_fields is not None:
|
||||
for field in action.assign_custom_fields.all():
|
||||
CustomFieldInstance.objects.create(
|
||||
field=field,
|
||||
document=document,
|
||||
) # adds to document
|
||||
if (
|
||||
CustomFieldInstance.objects.filter(
|
||||
field=field,
|
||||
document=document,
|
||||
).count()
|
||||
== 0
|
||||
):
|
||||
# can be triggered on existing docs, so only add the field if it doesnt already exist
|
||||
CustomFieldInstance.objects.create(
|
||||
field=field,
|
||||
document=document,
|
||||
)
|
||||
|
||||
document.save()
|
||||
|
||||
|
Reference in New Issue
Block a user