Skip to main content
Version: v1.0.0(int)

W128: Bulk-import purchase orders

Creates many POs at once from an uploaded CSV or Excel file. Triggered from the Data page, POs import. The whole import succeeds or fails atomically; partial imports are deliberately not supported.

Steps

  1. Parse the upload. Read the file into rows of { header, items[] }. Collect per-row parse errors into a list rather than throwing on the first one.

  2. Abort on parse failures. If any rows failed to parse, raise a ValidationError that lists them. Nothing is persisted.

  3. Create each PO inside one transaction. Open one withTransaction. For each parsed row, run the Create PO flow (W111) steps 1 to 5. The step-5 reconciliation projector writes ORDER ledger entries only for rows whose initial status leaves Planning (and isn't Cancelled).

  4. Commit. On any single-row failure, the entire batch rolls back.

Returns

The list of created PO numbers.

Business rules

  • All or nothing. Atomic import; the user never has to reconcile which subset of rows landed.
  • PO numbers in the file are advisory. The workflow always generates fresh numbers from the org's counter to avoid colliding with existing POs.

Errors

  • ValidationError. Parse failures listed per row, or any single row failing the Create PO rules.