Easy-Acumatica Docs

Ledgers Service

The `LedgersService` provides a straightforward way to retrieve a list of Ledgers from your Acumatica instance.

Importing Helpers

To build queries for retrieving ledgers, you will need to import `QueryOptions` and the `F` filter factory.

python

from easy_acumatica.models.query_builder import QueryOptions  
from easy_acumatica.models.filter_builder import F

Service Method

get_ledgers(api_version, options=None)

This is the main method for fetching a list of ledger records. It can be used to get all ledgers or a filtered subset by using `QueryOptions`.

Example 1: Get All Ledgers with Expanded Details

This example retrieves all ledgers and uses `$expand` to also fetch the companies and branches associated with each ledger.

python

# Use QueryOptions to select fields and expand related entities
opts = QueryOptions(
    select="LedgerID,Description,Branches/BranchID",
    expand="Branches"
)

# Fetch the ledgers
ledgers = client.ledgers.get_ledgers("24.200.001", options=opts)

Example 2: Get a Specific Ledger by ID

You can use a filter to retrieve a single, specific ledger.

python

# Create a filter for the 'ACTUAL' ledger
ledger_filter = (F.LedgerID == 'ACTUAL')
opts = QueryOptions(filter=ledger_filter)

# Fetch the specific ledger
actual_ledger_list = client.ledgers.get_ledgers("24.200.001", options=opts)
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