Skip to main content

PurchaseOrderLoad

Purchase order headers. Each PO references an organization (via organization_unit_code) and a supplier (via supplier_code). Lines are a separate object: see PurchaseOrderLineLoad.

Import​

from lib.objects.purchase_order import PurchaseOrderLoad

Standard BaseLoad methods​

get_all(), search(), new(), save_all(), patch_all(), delete_keys(), obj.save(), obj.delete(). See BaseLoad. Purchase orders have no active flag, so obj.deactivate() raises ValueError: delete instead.

Run it from the get_purchaseorder entrypoint. Its job token may read and write purchase orders and PO lines, and read organizations and suppliers (to map your system's ids to their codes).

Keys​

A purchase order is found by its Nuntiq id or by source_system + source_document_id. po_number is not a key: two source systems can hold the same PO number.

PurchaseOrder fields​

FieldRequiredNotes
po_numberyesThe customer-facing PO number
source_document_idyesThe PO's id in your system. With the source system, the key
po_dateISO date
organization_unit_codeReferences organization.code
supplier_codeReferences supplier.supplier_number
supplier_location_code
buyerFree-form (email, name, etc.)
requesterFree-form
statusFree-form (OPEN, CLOSED, APPROVED, ...)
currency_code3-letter ISO, stored upper case
expected_delivery_dateISO date
comments
net_amount / tax_amount / gross_amountNumbers
sourceOptional free-form source tag
source_systemLeave out, or the connector's source system
source_updated_atWhen your system last changed the PO; an older value than the stored one is not applied
custom_text_1..15Text
custom_number_1..15Numbers
custom_date_1..15ISO dates

Read-only on GET: id, created_at, updated_at, and is_deleted / deleted_at with include_deleted=True.

Save order​

When importing PO + lines + receipts together, save in this order:

  1. Organizations: referenced by the PO header
  2. Suppliers: referenced by the PO header
  3. Purchase orders
  4. PO lines: name their PO by source_document_id
  5. Receipts: name their line by source_line_id

Example​

from lib.objects.purchase_order import PurchaseOrderLoad

def run(context):
load = PurchaseOrderLoad(context)

po = load.new()
po.po_number = 'PO-2026-0042'
po.po_date = '2026-04-25'
po.organization_unit_code = 'EMEA'
po.supplier_code = 'SUP-100'
po.currency_code = 'EUR'
po.net_amount = 1500.00
po.tax_amount = 315.00
po.gross_amount = 1815.00
po.source_document_id = 'ERP-PO-42'
po.custom_text_1 = 'priority'
po.custom_number_1 = 30 # e.g. payment terms, days
po.custom_date_1 = '2026-05-31' # e.g. customer-specific cutoff

results = load.save_all()
return {'saved': len(results)}

save_all(full_load=True) is a sync run: your POs that the run did not send are deleted afterwards, with their lines and receipts.

Exact-match filters: po_number, organization_unit_code, supplier_code, status, source_system, source_document_id, plus updated_since and include_deleted.

# All open POs for a supplier
for po in load.search(supplier_code='SUP-100', status='OPEN'):
print(po.po_number, po.gross_amount)

Delete​

load.delete_keys([{'source_document_id': 'ERP-PO-42'}])

Soft delete. Deleting a PO also deletes its lines and their receipts. Sending the PO again restores it; its lines and receipts come back as you send them again. Purchase orders have no is_active: delete or keep.