feature/csv-pruebas

This commit is contained in:
2026-03-18 15:33:40 -06:00
parent 5e0edfa489
commit 4b4bb9e8a7
2 changed files with 5 additions and 5 deletions

View File

@@ -44,15 +44,15 @@ def scan_file(self, job_id: str, model_target: str, config: str = None):
if model_target == "invoice_header":
from api.v1.modules.a76.layouts_csv.facturas.tasks import _do_scan_file
return _do_scan_file(job_id, "invoice_header", config, job_type_override="exp")
return _do_scan_file(self, job_id, "invoice_header", config, job_type_override="exp")
if model_target == "invoice_details":
from api.v1.modules.a76.layouts_csv.facturas.tasks import _do_scan_file
return _do_scan_file(job_id, "invoice_details", config, job_type_override="exp")
return _do_scan_file(self, job_id, "invoice_details", config, job_type_override="exp")
if model_target == "invoice_series":
from api.v1.modules.a76.layouts_csv.facturas.tasks import _do_scan_file
return _do_scan_file(job_id, "invoice_series", config, job_type_override="exp")
return _do_scan_file(self, job_id, "invoice_series", config, job_type_override="exp")
# Fallback (e.g. unknown model_target)
file_path = _ensure_file(job_id)

View File

@@ -185,10 +185,10 @@ def _validate_customs_broker_ref(
@celery_app.task(bind=True)
def scan_file(self, job_id: str, model_target: str, config: str = None, job_type_override: Optional[str] = None):
"""Pass 1: Read CSV, Validate types, Write Errors to JSONL. Delegates to _do_scan_file."""
return _do_scan_file(job_id, model_target, config, job_type_override)
return _do_scan_file(self, job_id, model_target, config, job_type_override)
def _do_scan_file(job_id: str, model_target: str, config: Optional[str] = None, job_type_override: Optional[str] = None) -> Dict[str, Any]:
def _do_scan_file(self, job_id: str, model_target: str, config: Optional[str] = None, job_type_override: Optional[str] = None) -> Dict[str, Any]:
"""Pass 1 body: load file/meta from storage, run validations, store error lines. Uses effective_job_type for storage."""
effective_job_type = job_type_override if job_type_override is not None else JOB_TYPE
log_prefix = "Exportación import" if effective_job_type else "Invoices import"