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.
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.
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.
# 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.
# 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.
ON THIS PAGE
Introduction
Importing Builder
Builder Methods
- Standard Fields
- .add_detail()
- .add_package()
- .to_body()