Bills Service
The `BillsService` is a high-level helper for interacting with `Bill` resources. It provides methods to create, approve, and release retainage on bills within your Acumatica instance.
Importing Helpers
To effectively use the service, you will need to import the `BillBuiler` for creating payloads and the `QueryOptions` and `F` factory for filtering.
from easy_acumatica.models.bill_builder import BillBuilder
from easy_acumatica.models.query_builder import QueryOptions
from easu_acumatica.models.filter_builder import F
Service Methods
create_bill(api_version, builder, options=None)
Creates a new bill. You must provide a BillBuilder instance containing the bill's details, such as the vendor, reference number, and line items..
# 1. Build the bill payload
bill_payload = (
BillBuilder()
.type("Bill")
.vendor("VENDACME")
.reference_nbr("VENDORINV-001")
.description("Project materials with retainage")
.add_detail(
inventory_id="RAW-STEEL",
quantity=10,
unit_cost=100.00,
retained_amount=100.00 # 10% retainage
)
)
# 2. Use the payload to create the record
new_bill = client.bills.create_bill(
"24.200.001",
builder=bill_payload)
approve_bill(api_version, reference_nbr)
This method invokes the `Approve`` action on an existing bill, changing its status. You must provide the ReferenceNbr of the bill you wish to approve.
# Approving Bill 000001
bill_ref_nbr = "000001"
client.bills.approve_bill("24.200.001", reference_nbr=bill_ref_nbr)
print(f"Successfully approved Bill: {bill_ref_nbr}")
release_retainage(api_version, reference_nbr, parameters)
This method invokes the `ReleaseRetainage` action. You must provide the ReferenceNbr and can optionally provide parameters like RetainagePercent or RetainageAmount in a raw dictionary.
# Release retainage for the bill #000001
bill_ref_nbr = "000001"
# Parameters for releasing a specific amount of retainage
retainage_params = {"RetainageAmount": 50.00}
client.bills.release_retainage(
"24.200.001",
reference_nbr=bill_ref_nbr,
parameters=retainage_params
)