Easy-Acumatica Docs

Work Locations Service

This guide covers the `WorkLocationsService`, which is your primary tool for creating and retrieving work location records through the contract-based API.

Importing Helpers

Before you start, import the necessary builders and query helpers.

python

from easy_acumatica.models.work_location_builder import WorkLocationBuilder
from easy_acumatica.models.query_builder import QueryOptions
from easy_acumatica.filters import F

Service Methods

create_work_location(api_version, builder, options=None)

This method creates a new work location. You must provide a `WorkLocationBuilder` instance containing the location's details.

python

# 1. Build the work location payload
# This assumes a WorkLocationBuilder with methods like location_id and description
location_payload = (
    WorkLocationBuilder()
    .location_id("WAREHOUSE-B")
    .description("Secondary Warehouse Location")
    .active(True)
)

# 2. Use the payload to create the record
try:
    new_location = client.work_locations.create_work_location("24.200.001", builder=location_payload)
    print(f"Successfully created Work Location: {new_location['LocationID']['value']}")
except Exception as e:
    print(f"Failed to create work location: {e}")
get_work_locations(api_version, options=None)

This method retrieves a list of work locations. You can use `QueryOptions` to filter for specific locations.

python

# 1. Define query options
query = QueryOptions(filter=F.Active == True)

# 2. Retrieve the work location(s)
try:
    locations = client.work_locations.get_work_locations("24.200.001", options=query)
    for loc in locations:
        print(f"ID: {loc['LocationID']['value']}, Description: {loc['Description']['value']}")
except Exception as e:
    print(f"Failed to get work locations: {e}")
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