mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-21 04:52:40 +00:00
Fix: finish manual and bulk zone OCR runs like other bulk edits
Runs reindexed each document separately, never sent document_updated and did not bump modified for custom field writes. They now finish through bulk_update_documents for the documents that got a value.
This commit is contained in:
1 parent
0bca50588d
commit
54be9dc9c5
9 files changed
+368
-45
No files matched your search
@@ -1264,8 +1264,23 @@ def run_zone_ocr(
|
||||
template: int | None = None,
|
||||
user: User | None = None,
|
||||
) -> Literal["OK"]:
|
||||
"""Run zone OCR within the tracked bulk operation task."""
|
||||
for document_id in doc_ids:
|
||||
extract_zones(document_id=document_id, template_id=template, requester=user)
|
||||
"""
|
||||
Run zone OCR within the tracked bulk operation task, then finish once for
|
||||
the root documents that had a value written.
|
||||
"""
|
||||
written_ids: list[int] = []
|
||||
try:
|
||||
for document_id in doc_ids:
|
||||
written_id = extract_zones(
|
||||
document_id=document_id,
|
||||
template_id=template,
|
||||
requester=user,
|
||||
)
|
||||
if written_id is not None:
|
||||
written_ids.append(written_id)
|
||||
finally:
|
||||
# Documents already written are finished even if a later one raises.
|
||||
if written_ids:
|
||||
bulk_update_documents(list(dict.fromkeys(written_ids)))
|
||||
|
||||
return "OK"
|
||||
Reference in new issue
Block a user