fix: restore monthly archive temp file builders
Some checks failed
ERP CI/CD Pipeline / test (push) Has been cancelled
ERP CI/CD Pipeline / Deploy (server git pull + compose) (push) Has been cancelled

The monthly ZIP job was still being requested normally, but the backend archive task could not create its temp archive files because the helper functions were missing. Restore those builders so the archive task can complete and emit the final generated_archive notification.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
mariomitte
2026-09-08 10:32:49 +02:00
parent f243bad6db
commit fc2a683b9c

View File

@@ -5,6 +5,7 @@ from io import StringIO
import base64
import csv
import mimetypes
import tempfile
import threading
import zipfile
import re
@@ -2937,6 +2938,25 @@ def _generated_archive_filename_for_user(user, *, year, month, archive_type):
return f"{prefix}-{month:02d}-{year}-{suffix}.zip"
def _build_monthly_archive_to_temp_file(*, user, year, month, archive_type):
if archive_type == 'service_tasks':
archive_content = _build_monthly_service_tasks_archive_content(user=user, year=year, month=month)
else:
archive_content = _build_monthly_work_orders_archive_content(user=user, year=year, month=month)
with tempfile.NamedTemporaryFile(delete=False, suffix='.zip') as temp_file:
temp_file.write(archive_content)
return Path(temp_file.name)
def _build_monthly_service_tasks_archive_to_temp_file(*, user, year, month):
return _build_monthly_archive_to_temp_file(user=user, year=year, month=month, archive_type='service_tasks')
def _build_monthly_work_orders_archive_to_temp_file(*, user, year, month):
return _build_monthly_archive_to_temp_file(user=user, year=year, month=month, archive_type='work_orders')
def _unique_zip_entry_name(entry_name, used_names):
candidate = entry_name
entry_path = Path(entry_name)