Easy-Acumatica Docs

Time Entries Service

This guide covers the `TimeEntriesService`, which is your primary tool for creating and retrieving time entry records through the contract-based API.

Importing Helpers

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

python

from easy_acumatica.models.time_entry_builder import TimeEntryBuilder
from easy_acumatica.models.query_builder import QueryOptions
from easy_acumatica.filters import F

Service Methods

create_time_entry(api_version, builder, options=None)

Creates a new time entry. You must provide a `TimeEntryBuilder` instance containing the entry's details.

python

# 1. Build the time entry payload
time_entry_payload = (
    TimeEntryBuilder()
    .summary("Worked on API integration task")
    .date("2022-08-18T10:00:00")
    .employee("EP00000026")
    .project_id("INTERNAL")
    .project_task_id("DEV")
    .earning_type("RG")
    .time_spent("02:00")
    .billable_time("02:00")
)

# 2. Use the payload to create the record
try:
    new_entry = client.time_entries.create_time_entry("24.200.001", builder=time_entry_payload)
    print(f"Successfully created Time Entry with ID: {new_entry['TimeEntryID']['value']}")
except Exception as e:
    print(f"Failed to create time entry: {e}")
get_time_entries(api_version, options=None)

Retrieves a list of time entries. You must use `QueryOptions` to filter, select, and expand the results.

python

# 1. Define query options
query = QueryOptions(
    filter=(F.Employee == 'EP00000026') & (F.Date >= '2022-08-15') & (F.Date < '2022-08-22'),
    select="Date,ProjectID,TimeSpent,Summary"
)

# 2. Retrieve the time entries
try:
    time_entries = client.time_entries.get_time_entries("24.200.001", options=query)
    for entry in time_entries:
        print(f"Date: {entry['Date']['value']}, Project: {entry['ProjectID']['value']}, Time: {entry['TimeSpent']['value']}")
except Exception as e:
    print(f"Failed to get time entries: {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