Easy-Acumatica Docs

SalesOrderBuilder

The `SalesOrderBuilder` is a fluent builder for creating the JSON payload needed to create or update `SalesOrder` records. It handles top-level fields as well as nested lists for details, payments, and taxes.

Importing the Builder

To get started, import the `SalesOrderBuilder` from the `easy_acumatica.models` module.

python

from easy_acumatica.models.sales_order_builder import SalesOrderBuilder

Builder Methods

Standard Fields

Use the shortcut methods to set common header-level fields on the sales order. For any other field, you can use the generic `.set()` method.

python

so_payload = (
    SalesOrderBuilder()
    .order_type("SO")
    .customer_id("ABCCORP")
    .hold(False)
    .set("Description", "Order for new project materials")
)
.add_detail(**kwargs)

Adds a detail line to the sales order. You can pass any line-level field as a keyword argument.

python

so_payload.add_detail(
    InventoryID="ITEM01",
    OrderQty=5,
    UnitPrice=100.0
)
.add_payment(**kwargs)

Adds a payment to the sales order.

python

so_payload.add_payment(
    PaymentAmount=500.00,
    PaymentMethod="VISA"
)
.add_tax_detail(**kwargs)

Adds a tax detail line to the sales order, typically for tax overrides.

python

so_payload.add_tax_detail(
    TaxID="NYSTATETAX",
    TaxAmount=42.50
)
.to_body()

Once you have set all the required fields and details, call `.to_body()` to generate the final dictionary, ready to be sent as the JSON body in your API request.

Easy-Acumatica v0.3.9 — Created and Developed by Matthew Hirstius (Nioron07).
Significant Contributions made by Chris Xu
Want to see the NPM version? See it here