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
| Field | Required | Notes |
|---|---|---|
po_number | yes | The customer-facing PO number |
source_document_id | yes | The PO's id in your system. With the source system, the key |
po_date | ISO date | |
organization_unit_code | References organization.code | |
supplier_code | References supplier.supplier_number | |
supplier_location_code | ||
buyer | Free-form (email, name, etc.) | |
requester | Free-form | |
status | Free-form (OPEN, CLOSED, APPROVED, ...) | |
currency_code | 3-letter ISO, stored upper case | |
expected_delivery_date | ISO date | |
comments | ||
net_amount / tax_amount / gross_amount | Numbers | |
source | Optional free-form source tag | |
source_system | Leave out, or the connector's source system | |
source_updated_at | When your system last changed the PO; an older value than the stored one is not applied | |
custom_text_1..15 | Text | |
custom_number_1..15 | Numbers | |
custom_date_1..15 | ISO 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:
- Organizations: referenced by the PO header
- Suppliers: referenced by the PO header
- Purchase orders
- PO lines: name their PO by
source_document_id - 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.
Search
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.