ReceiptLoad
Goods receipts (matches/exceeds against PO lines). Each receipt references a PO + line and a source-system receipt-line id.
Import
from lib.objects.receipt import ReceiptLoad
Standard BaseLoad methods
See baseload.md.
Receipt fields
| Field | Required | Notes |
|---|---|---|
id | (assigned) | UUID |
po_number | yes | Matches purchase_order.po_number |
po_line_number | yes | Matches the PO line's po_line_number |
receipt_line_number | yes | Receipt line within the same PO line (you can have multiple partial receipts) |
receipt_number | Free-form GR number, e.g. GR-2026-0042 | |
receipt_date | ISO date | |
quantity | yes | float — quantity received |
unit_price | yes | float |
net_amount | yes | float — usually quantity * unit_price |
tax_amount / gross_amount | floats; auto-filled to net_amount + tax_amount if absent | |
unit_of_measure | ||
location_code | Where received | |
received_by | ||
comments | ||
source_document_id | yes | Source-system PO id |
source_line_id | yes | Source-system PO-line id |
source_receipt_line_id | yes | Upsert key — source-system unique id for this receipt line |
is_deleted | Soft-delete flag. Receipt supports soft-delete only — there is no is_active / deactivate path. | |
custom_text_1..10 | text | |
custom_number_1..10 | numeric | |
custom_date_1..10 | ISO date |
Example
from lib.objects.receipt import ReceiptLoad
def run(context):
load = ReceiptLoad(context)
r = load.new()
r.po_number = 'PO-2026-0042'
r.po_line_number = '1'
r.receipt_line_number = '1'
r.receipt_number = 'GR-2026-0042'
r.receipt_date = '2026-04-26'
r.quantity = 100
r.unit_price = 12.50
r.net_amount = 1250.00
r.location_code = 'WAREHOUSE-AMS'
r.source_document_id = 'ERP-PO-42'
r.source_line_id = 'ERP-PO-42-L1'
r.source_receipt_line_id = 'ERP-RCV-42-1'
load.save_all()
return {'created': 1}
Partial receipts
If the PO line is for 100 units and you receive 60 then 40, that's two
receipts with the same PO + PO-line and different
receipt_line_number and source_receipt_line_id.
# First delivery: 60 units
r1 = load.new()
r1.po_number = 'PO-2026-0042'
r1.po_line_number = '1'
r1.receipt_line_number = '1' # first partial
r1.quantity = 60
r1.source_receipt_line_id = 'ERP-RCV-42-1A'
# ... fill in the rest ...
# Second delivery: 40 units
r2 = load.new()
r2.po_number = 'PO-2026-0042'
r2.po_line_number = '1'
r2.receipt_line_number = '2' # second partial
r2.quantity = 40
r2.source_receipt_line_id = 'ERP-RCV-42-1B'
# ... fill in the rest ...
load.save_all()
Search
# All receipts for a PO
for r in load.search(po_number='PO-2026-0042'):
print(r.receipt_number, r.quantity)