Easy-Acumatica Docs

TaxCategoryBuilder

The `TaxCategoryBuilder` is your primary tool for creating the JSON payload needed to create or update `TaxCategory` records with the `TaxCategoryService`. It provides a fluent, chainable interface for setting the fields of a tax category.

Importing the Builder

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

python

from easy_acumatica.models.tax_category_builder import TaxCategoryBuilder

Builder Methods

Shortcut Methods

Use the shortcut methods to set the most common fields for a tax category.

python

tax_category_payload = (
    TaxCategoryBuilder()
    .tax_category_id("SERVICES")
    .description("Taxable Professional Services")
    .active(True)
    .exclude_listed_taxes(False)
    .note("Default tax category for all service items.")
)
.set(field_name, value)

This is the general-purpose method for setting any other field on the tax category record.

python

builder = TaxCategoryBuilder()
builder.set("TaxCategoryID", "GOODS")
builder.set("Description", "Taxable Goods")
.to_body()

Once you have set all the required fields, call `.to_body()` to generate the final dictionary, ready to be sent as the JSON body in your API request.

python

# Build the tax category
tax_category_payload = (
    TaxCategoryBuilder()
    .tax_category_id("EXEMPT")
    .description("Non-taxable items")
    .active(True)
)

# Get the final dictionary
json_body = tax_category_payload.to_body()

# The json_body will look like this:
# {
#   "TaxCategoryID": {"value": "EXEMPT"},
#   "Description": {"value": "Non-taxable items"},
#   "Active": {"value": True}
# }

# Use with the TaxCategoryService
# client.tax_categories.update_tax_category("24.200.001", builder=tax_category_payload)
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