mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-21 04:52:40 +00:00
Fix: make bulk zone OCR survive a missing template or failing document
Inline extract_zones into run_zone_ocr, load documents and the template once, and process each root once. A failing document is logged and the task fails after the rest finish.
This commit is contained in:
1 parent
a08918eb9c
commit
ccbff94208
6 files changed
+346
-328
No files matched your search
@@ -118,8 +118,12 @@ def execute_bulk_operation(
|
||||
raise PermissionDenied("Insufficient permissions to run this workflow")
|
||||
|
||||
if operation == "run_zone_ocr" and parameters.get("template") is not None:
|
||||
template = OcrTemplate.objects.get(pk=parameters["template"])
|
||||
if not has_perms_owner_aware(user, "view_ocrtemplate", template):
|
||||
template = OcrTemplate.objects.filter(pk=parameters["template"]).first()
|
||||
if template is not None and not has_perms_owner_aware(
|
||||
user,
|
||||
"view_ocrtemplate",
|
||||
template,
|
||||
):
|
||||
raise PermissionDenied("Insufficient permissions to run this OCR template")
|
||||
|
||||
actor_context = set_actor(user) if settings.AUDIT_LOG_ENABLED else nullcontext()
|
||||
|
||||
Reference in new issue
Block a user