Easy-Acumatica Docs

BillBuilder

The BillBuilder is your primary tool for creating the JSON payload needed to create or update Bill records with the BillsService. It provides a fluent, chainable interface for setting the fields of a bill record, including linking to purchase orders or receipts.

Importing the Builder

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

python

from easy_acumatica.models.bill_builder import BillBuilder

Builder Methods

The builder provides both general-purpose and shortcut methods for constructing a valid JSON payload. Most bills will also include one or more detail lines.

Shortcut Methods

For common fields like vendor and vendor reference, you can use built-in shortcuts:

python

bill_payload = (
    BillBuilder()
    .vendor("VENDACME")
    .vendor_ref("INV-12345")
    .type("Bill")
)
set(field_name, value)

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

python

builder = BillBuilder()
builder.set("Status", "Balanced")
builder.set("Terms", "Net30")
to_body()

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

python

bill_payload = (
    BillBuilder()
    .vendor("VENDACME")
    .vendor_ref("INV-12345")
    .add_detail(inventory_id="ITEM01", qty=10, unit_cost=5.00)
)
json_body = bill_payload.to_body()

Adding Details

add_detail_from_pr(po_receipt_nbr)

The most common method, used for linking bills to received goods.

python

bill_payload = (
    BillBuilder()
    .type("Bill")
    .vendor("VENDACME")
    .vendor_ref("INV-12345")
    .description("Bill for received goods")
    .add_detail_from_pr(po_receipt_nbr="PR000789")
)
add_detail(**kwargs)

Use this when the bill is not tied to a PO or receipt, like utility or service bills.

python

expense_payload = (
    BillBuilder()
    .vendor("UTILITIES")
    .vendor_ref("ACCT-555")
    .add_detail(
        expense_account="700100",
        tran_desc="Monthly electricity bill",
        qty=1,
        unit_cost=250.75
    )
)
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