Transactions Service
The `TransactionsService` provides methods for retrieving financial transaction data from Acumatica ERP. Its primary function is to query the General Ledger for transaction details within a specified date range.
Importing Helpers
You will need Python's built-in `datetime` module to specify the date range and `QueryOptions` from `easy_acumatica.models` to expand the results.
from datetime import datetime
from easy_acumatica.models.query_builder import QueryOptions
Service Method
get_ledger_transactions(api_version, start_date, end_date, options=None)
This method retrieves general ledger transactions for a specified period by using the `AccountDetailsForPeriodInquiry` form. Unlike most retrieval methods, this inquiry requires a `PUT` request where the date range is sent in the body. The `easy-acumatica` library handles this complexity for you.
To get the actual transaction lines, you must expand the `Results` entity in your `QueryOptions`.
# Define the start and end of the period
start_date = datetime(2024, 4, 1)
end_date = datetime(2024, 4, 30)
# The 'Results' entity must be expanded to get the transaction lines
opts = QueryOptions(expand=["Results"])
# Call the service
ledger_transactions = client.transactions.get_ledger_transactions(
"24.200.001",
start_date=start_date,
end_date=end_date,
options=opts
)
# The actual transactions are in the 'Results' list
for trx in ledger_transactions.get("Results", []):
print(f"Ref: {trx['RefNumber']['value']}, Desc: {trx['TransactionDescription']['value']}")
ON THIS PAGE
Introduction
Importing Helpers
Service Method
- get_ledger_transactions