v1
Materials
Materials

Generate Purchase Orders

Changed on

Generate Purchase Order PDFs for multiple vendors.

For each PO group:

  1. Resolves the PO number (minting one via next_vendor_po_number when the caller does not supply one) and generates a PO PDF
  2. Uploads it, seeds a files row, and creates -- or on reissue updates -- a procurement_documents row at lifecycle_status='DRAFT'

It writes NOTHING onto manual_material_items: not status, not po_number, not po_document_id / po_date / vendor_id. The one exception is the 'doc_regenerated' state_history entry appended to the group's representative item on a reissue.

So at this point the item -> PO association lives ONLY in the document's metadata.item_ids / metadata.items snapshot; nothing on the item rows points back to the document (JEEVY-1349). The caller is what advances items: RaisePOConfirmModal PATCHes po_number and qs_state after this returns, and /backfill-po-numbers repairs items that missed it. See the NOTE at the end of the per-group loop below for why the status transition is deliberately not performed here.

post/api/v1/materials/generate-purchase-orders

Request

  • Base URL
    https://api.jeevyfabrication.com (the document declares no server; this is the origin it was published from)
  • Auth
    none declared

Request body

GeneratePurchaseOrdersBody required
project_id, integer nullable
purchase_orders, PurchaseOrderGroup[] required
reissue, boolean
preview, boolean

Response

Successful Response

object required

Changes

    • info

      added the new optional request property purchase_orders/items/attachments

    • info

      added the new optional request property preview

    • info

      added the new optional request property purchase_orders/items/delivery_address

    1 more change in this revision