PurchaseOrderBuilder
The `PurchaseOrderBuilder` is your primary tool for creating the JSON payload needed to create `PurchaseOrder` records with the `PurchaseOrdersService`.
Importing the Builder
To get started, import the `PurchaseOrderBuilder` from the `easy_acumatica.models` module.
from easy_acumatica.models.payment_builder import PaymentBuilder
Builder Methods
Standard Fields
Use the shortcut methods to set common header-level fields on the purchase order. For any other field, you can use the generic `.set()` method.
po_payload = (
PurchaseOrderBuilder()
.vendor_id("GOODFRUITS")
.location("MAIN")
.hold(False)
.set("Description", "Weekly fruit order")
)
add_detail(**kwargs)
Use this method to add line items to the purchase order. You can pass any line-level field as a keyword argument.
po_payload = (
PurchaseOrderBuilder()
.vendor_id("GOODFRUITS")
.add_detail(
InventoryID="APPLES",
OrderQty=100,
UOM="LB"
)
.add_detail(
InventoryID="ORANGES",
OrderQty=50,
UOM="CASE"
)
)
# Use with the PurchaseOrdersService
# client.purchase_orders.create_purchase_order("24.200.001", builder=po_payload)
to_body()
Once you have set all the required fields and details, call `.to_body()` to generate the final dictionary, which is ready to be sent as the JSON body in your API request.
ON THIS PAGE
Introduction
Importing Builder
Builder Methods
- Standard Fields
- .add_detail()
- .to_body()