PurchaseOrderLineLoad
Purchase order line items. A line belongs to the purchase order of its
source_document_id (same source system), which must exist.
Import
from lib.objects.purchase_order_line import PurchaseOrderLineLoad
Standard BaseLoad methods
get_all(), search(), new(), save_all(), patch_all(),
delete_keys(), obj.save(), obj.delete(). See
BaseLoad. PO lines have no active flag, so
obj.deactivate() raises ValueError: delete instead.
Run it from the get_purchaseorder entrypoint, next to the purchase
orders.
Keys
A line is found by its Nuntiq id or by source_system +
source_line_id.
PurchaseOrderLine fields
| Field | Required | Notes |
|---|---|---|
source_line_id | yes | The line's id in your system. With the source system, the key |
source_document_id | yes | Names the PO (its source_document_id); the PO must exist |
po_line_number | yes | Line number within the PO (1, 2, ...) |
po_number | Taken from the PO when left out | |
product_code_1 | Primary product / SKU code | |
product_name | ||
product_code_2 | Alternate / customer-side product code | |
unspsc_code | ||
description | Long-form description, separate from product_name | |
requester / buyer | ||
quantity | Number | |
unit_of_measure | e.g. EA, KG, HR | |
unit_price | Number | |
quantity_alt / unit_of_measure_alt / unit_price_alt | A second unit of measure | |
currency_code | Stored upper case | |
expected_delivery_date | ISO date | |
ship_to_location_code | ||
net_amount / tax_amount / gross_amount | Numbers | |
status | ||
source_system / source_updated_at | As on the PO | |
custom_text_1..15 | Text | |
custom_number_1..10 | Numbers | |
custom_date_1..10 | ISO dates |
Example
from lib.objects.purchase_order_line import PurchaseOrderLineLoad
def run(context):
load = PurchaseOrderLineLoad(context)
line = load.new()
line.po_line_number = '1'
line.source_document_id = 'ERP-PO-42' # the PO
line.source_line_id = 'ERP-PO-42-L1' # this line
line.product_code_1 = 'WIDGET-A'
line.product_name = 'Office Widget'
line.quantity = 100
line.unit_of_measure = 'EA'
line.unit_price = 12.50
line.currency_code = 'EUR'
line.net_amount = 1250.00
line.custom_text_1 = 'urgent'
line.custom_number_1 = 5 # e.g. priority rank
line.custom_date_1 = '2026-05-10'
results = load.save_all()
return {'saved': len(results)}
A line whose PO does not exist (for your source system) is rejected; save the purchase orders first.
Search
Exact-match filters: po_number, source_document_id, status,
source_system, source_line_id, plus updated_since and
include_deleted.
# All lines for a specific PO
for line in load.search(source_document_id='ERP-PO-42'):
print(line.po_line_number, line.description, line.net_amount)
Delete
load.delete_keys([{'source_line_id': 'ERP-PO-42-L1'}])
Soft delete. Deleting a line also deletes its receipts. Lines have no
is_active: delete or keep.