Easy-Acumatica Docs

ShipmentBuilder

The `ShipmentBuilder` is your primary tool for creating the JSON payload needed to create or update `Shipment` records with the `ShipmentsService`.

Importing the Builder

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

python

from easy_acumatica.models.shipment_builder import ShipmentBuilder

Builder Methods

Standard Fields

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

python

shipment_payload = (
    ShipmentBuilder()
    .type("Shipment")
    .customer_id("CUST001")
    .warehouse_id("MAIN")
    .shipment_date("2023-10-27T00:00:00")
    .set("ShipVia", "FEDEXG")
)
.add_detail(**kwargs)

Adds a detail line to the shipment, typically referencing an order to be fulfilled.

python

# This adds a sales order line to the shipment
shipment_payload.add_detail(
    OrderType="SO",
    OrderNbr="SO005555"
)
.add_package(**kwargs)

Adds a package to the shipment, including its box type, weight, and other details.

python

# This adds a package to the shipment
shipment_payload.add_package(
    BoxID="MEDIUMBOX",
    Weight=15.2,
    DeclaredValue=250.00
)
.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