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.
Warning: This service is currently untested due to limitations in the development environment. Please contact the library maintainers on GitHub if you encounter any issues with this specific endpoint.
Importing Helpers
Before you start, import the necessary builders and query helpers.
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.
# 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.
# 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}")
ON THIS PAGE
Introduction
Importing Helpers
Service Methods
- create_work_location
- get_work_locations