Easy-Acumatica Docs

BOMBuilder

The BOMBuilder is your primary tool for creating the JSON payload needed to create Bill of Material (BOM) records with the BomsService. It provides a fluent, chainable interface for setting the fields of a BOM record and supports defining multiple operations and materials.

Importing the Builder

To get started, import the BOMBuilder from the models directory.

python

from easy_acumatica.models.bom_builder import BOMBuilder

Builder Methods

The builder provides both general-purpose and shortcut methods for constructing a valid JSON payload. The core of building a BOM is adding operations and their associated materials.

Shortcut Methods

Use shortcut methods to set commonly used top-level fields.

python

bom_payload = (
    BOMBuilder()
    .bom_id("FINISHED-PRODUCT")
    .inventory_id("FINISHED-PRODUCT")
    .revision("A")
    .description("Main assembly BOM")
)
set(field_name, value)

Use this to set any field that doesn't have a dedicated shortcut method.

python

builder = BOMBuilder()
builder.set("BOMType", "Manufacturing")
builder.set("IsActive", True)
to_body()

Generates the final dictionary formatted for use in your API request.

python

bom_payload = (
    BOMBuilder()
    .bom_id("SIMPLE-BOM")
    .inventory_id("SIMPLE-BOM")
    .revision("A")
    .add_operation(
        operation_nbr="10",
        work_center="ASSEMBLY",
        materials=[{"InventoryID": "COMPONENT-Z", "QtyRequired": 1.0}]
    )
)
json_body = bom_payload.to_body()

Adding Operations and Materials

add_operation(operation_nbr, work_center, materials)

Use this to add a manufacturing operation and its material list.

python

op_10_materials = [
    {"InventoryID": "RAW-PART-A", "QtyRequired": 2.0, "UOM": "EA"},
    {"InventoryID": "RAW-PART-B", "QtyRequired": 5.0, "UOM": "EA"}
]

bom_payload = (
    BOMBuilder()
    .bom_id("FINISHED-ASSEMBLY")
    .inventory_id("FINISHED-ASSEMBLY")
    .revision("A")
    .description("Multi-step Assembly BOM")
    .add_operation(
        operation_nbr="10",
        work_center="CUTTING",
        materials=op_10_materials
    )
    .add_operation(
        operation_nbr="20",
        work_center="WELDING",
        materials=[{"InventoryID": "SUB-ASSEMBLY-X", "QtyRequired": 1.0}]
    )
)
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