feature/fix-invoice-status
This commit is contained in:
@@ -4487,6 +4487,7 @@ def _do_insert_valid_rows(job_id: str, model_target: str, job_type_override: Opt
|
||||
InvoiceFinancials,
|
||||
InvoiceLogistics,
|
||||
InvoiceSalesDetails,
|
||||
InvoiceStatus,
|
||||
OperationType,
|
||||
TransportType,
|
||||
WeightUnit,
|
||||
@@ -4925,7 +4926,10 @@ def _do_insert_valid_rows(job_id: str, model_target: str, job_type_override: Opt
|
||||
header = existing_header
|
||||
header.invoice_date = invoice_date
|
||||
header.operation_type = op_type_value
|
||||
header.status = True # Mark as updated
|
||||
# CSV import only captures data; "processed" is set by the manual/import processing flow.
|
||||
# Legacy CSV imports may have persisted booleans ('True'/'False') into status.
|
||||
if header.status not in (InvoiceStatus.PENDING, InvoiceStatus.PROCESSED, InvoiceStatus.REVERSED):
|
||||
header.status = InvoiceStatus.PENDING
|
||||
header.updated_date = datetime.utcnow()
|
||||
capture_user = meta.get("capture_user") or "CSV"
|
||||
header.who_processed = capture_user
|
||||
@@ -4964,7 +4968,7 @@ def _do_insert_valid_rows(job_id: str, model_target: str, job_type_override: Opt
|
||||
invoice_number=invoice_number,
|
||||
invoice_date=invoice_date,
|
||||
operation_type=op_type_value,
|
||||
status=False,
|
||||
status=InvoiceStatus.PENDING,
|
||||
system="CSV",
|
||||
capture_date=datetime.utcnow(),
|
||||
capture_user=capture_user,
|
||||
|
||||
Reference in New Issue
Block a user