Timers¶
TimerNamespace for timer and timesheet management, accessed as client.timer.
Legacy running state comes from timer.timer. Access and transport failures from
that lookup propagate through list, active, and stop operations; they are not
interpreted as an empty timer list. A successful empty query still returns no
running timers. Optional task/ticket display-label reads remain best-effort.
This behavior is consistent across synchronous/asynchronous Python, TypeScript,
and Swift.
timer
¶
Odoo timer (timesheet) operations.
Supports starting/stopping timers on tasks, tickets, and timesheets. Handles version-specific differences: - Odoo 19+: timers live directly on account.analytic.line - Odoo 14-18: timers live in timer.timer; start/stop via source model
TimerState
¶
Bases: StrEnum
Timer state.
TimerSource
dataclass
¶
Source of a timer (task, ticket, or standalone timesheet).
Timesheet
dataclass
¶
Timesheet(id: int, name: str, project_name: str | None, source: TimerSource, unit_amount: float, timer_start: datetime | None, date: str)
A timesheet entry from Odoo's account.analytic.line model.
to_dict
¶
Serialize to a plain dictionary for JSON output.
Source code in src/vodoo/timer.py
TimerHandle
dataclass
¶
TimerHandle(_namespace: TimerNamespace, _source_kind: str, _source_id: int)
Handle returned by start_*() — call :meth:stop to stop this specific timer.
stop
¶
Stop the timer that was started with this handle.
Source code in src/vodoo/timer.py
TimerBackend
¶
Bases: ABC
Version-specific timer behavior.
enrich_with_running_state
abstractmethod
¶
enrich_with_running_state(timesheets: list[Timesheet], client: OdooClient, uid: int) -> list[Timesheet]
start_timer
abstractmethod
¶
start_timer(timesheet: Timesheet, client: OdooClient) -> None
stop_timer
abstractmethod
¶
stop_timer(timesheet: Timesheet, client: OdooClient) -> Any
Odoo19TimerBackend
¶
LegacyTimerBackend
¶
TimerNamespace
¶
TimerNamespace(client: OdooClient)
Namespace for timer (timesheet) operations.
Source code in src/vodoo/timer.py
list
¶
Fetch timesheets for the current user.
| PARAMETER | DESCRIPTION |
|---|---|
days
|
How many days back to include.
TYPE:
|
limit
|
Maximum number of records to return (
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Timesheet]
|
Timesheets sorted by date descending. |
Source code in src/vodoo/timer.py
active
¶
active() -> list[Timesheet]
Fetch currently running timesheets, including timers started before today.
start_task
¶
start_task(task_id: int) -> TimerHandle
start_timesheet
¶
start_timesheet(timesheet_id: int) -> TimerHandle
Start a timer on an existing timesheet.
Source code in src/vodoo/timer.py
stop_timesheet
¶
Stop a timer on an existing timesheet.
Handles stop wizards automatically (Odoo 14-18 and 19).
Source code in src/vodoo/timer.py
merge_running_timers
¶
merge_running_timers(timesheets: list[Timesheet], running_timers: list[Timesheet]) -> list[Timesheet]
Merge running timer info into existing timesheets.
Shared by both sync and async legacy backends.
Source code in src/vodoo/timer.py
build_running_timer
¶
build_running_timer(record: dict[str, Any], source: TimerSource, project_name: str | None, timer_start: datetime) -> Timesheet
Build a Timesheet representing a running timer from timer.timer data.