Easy-Acumatica Docs

BOMs Service

This guide covers the `BomsService`, which is your primary tool for creating and retrieving Bill of Material (BOM) records through yoiur Acumatica instance. This is if useful for the automation of creating BOMs or retrieving specific BOMs in software and other applications.

Importing Helpers

To effectively use the service, you will need to import the `BOMBuilder` for creating payloads and the `QueryOptions` and `F` factory for filtering.

python

from easy_acumatica.models.bom_builder import BOMBuilder
from easy_acumatica.models.query_builder import QueryOptions
from easu_acumatica.models.filter_builder import F

Service Method

create_bom(api_version, builder, options=None)

This method creates a new BOM. You must provide a `BOMBuilder` instance containing the BOM's details, such as the inventory item it's for and its components.

python

# 1. Build the BOM payload
bom_payload = (
    BOMBuilder()
    .bom_id("FINISHED-GOOD-01")
    .revision("A")
    .description("Initial production BOM")
    .add_material(
        component_id="RAW-PART-A",
        quantity=2,
        uom="EA"
    )
    .add_material(
        component_id="RAW-PART-B",
        quantity=1,
        uom="EA"
    )
)

# 2. Use the payload to create the record
new_bom = client.boms.create_bom("24.200.001", builder=bom_payload)
print(f"Successfully created BOM: {new_bom['BOMID']['value']} Rev: {new_bom['Revision']['value']}")

get_boms(api_version, bom_id, revision, options=None)

This method can retrieve either a list of all BOMs or a single BOM if both bom_id and revision are provided.

Example 1: Retrieving a list of all BOMs.
python

# Example 1. Define query options
query = QueryOptions(
    filter=F.Active == True,
    select="BOMID,Revision,Description"
)

# 2. Retrieve the BOMs
all_boms = client.boms.get_boms("24.200.001", options=query)
for bom in all_boms:
    print(f"BOM: {bom['BOMID']['value']}, Rev: {bom['Revision']['value']}")


Example 2: Retrieving a single BOM.
python

# 1. Retrieve the specific BOM
specific_bom = client.boms.get_boms(
    "24.200.001",
    bom_id="FINISHED-GOOD-01",
    revision="A",
)
print(f"Retrieved BOM: {specific_bom['BOMID']['value']}")

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