Use it from a coding agent¶
How to let a coding agent (Claude Code, Codex, …) book time and attendance
with odoo-work-cli. The agent runs the CLI through its shell tool, reads
JSON and branches on error kinds.
Give the agent the guide¶
odoo-work-cli llm --skill prints a Markdown guide for agents: every command
and flag, the JSON fields, the error kinds, workflows (booking entries,
backfilling attendance) and the pitfalls. It needs no config and no
connection, and it always matches the installed binary: the field lists and
error kinds are generated from the code, and a test fails when a command or
flag is missing from it.
Save it as a skill, for example for Claude Code:
mkdir -p ~/.claude/skills/odoo-work-cli
odoo-work-cli llm --skill > ~/.claude/skills/odoo-work-cli/SKILL.md
The file starts with the skill front matter (name, description), so the
agent loads it when the user asks to book hours or check working time.
Regenerate it after an update.
The rules the guide sets¶
- Always
--json, and read stdout only. - Exit code
0on success,1on any error. With--jsonthe error is one envelope on stdout:{"error":{"kind":"…","message":"…"}}. Branch onkind; see Errors and exit codes. - Look IDs up, never guess them:
projects --search,tasks,entries,clock list. - Preview writes:
entries add … --dry-run --json, show the proposal to the user, book only after approval. See Preview a write. - Never overwrite silently: backfill attendance with
clock edit --create-only; onconflict, ask. - No retry loops:
auth,access_denied,configandsecrets_lockedneed the user. - No TUI:
tuiis interactive.
A typical session¶
$ odoo-work-cli projects --search portal --json
[
{
"id": 1,
"name": "Lighthouse Portal",
"active": true,
"customer": "Example Harbor Ltd",
"company": "Example Consulting",
"stage": "In Progress",
"project_manager": "Alex Demo",
"extra_fields": {}
}
]
$ odoo-work-cli entries --date 2026-04-09 --json
[
{
"id": 4019,
"date": "2026-04-09",
"project_id": 3,
"project": "Internal",
"task_id": 31,
"task": "Meetings",
"description": "Customer call",
"hours": 0.75,
"minutes": 45,
"employee": "Alex Demo",
"status": "draft",
"company": "Example Consulting"
},
{
"id": 4018,
"date": "2026-04-09",
"project_id": 1,
"project": "Lighthouse Portal",
"task_id": 13,
"task": "Code review",
"description": "Review fuzzy matching",
"hours": 1.5,
"minutes": 90,
"employee": "Alex Demo",
"status": "draft",
"company": "Example Consulting"
},
{
"id": 4017,
"date": "2026-04-09",
"project_id": 2,
"project": "Orchard Mobile App",
"task_id": 21,
"task": "Release 2.4",
"description": "Store screenshots",
"hours": 2,
"minutes": 120,
"employee": "Alex Demo",
"status": "draft",
"company": "Example Consulting"
}
]
The agent sees that Review fuzzy matching is already booked, and its dry run reports it as a duplicate:
$ odoo-work-cli entries add --project-id 1 --task-id 13 --date 2026-04-09 --hours 1:30 --description "Review fuzzy matching" --dry-run --json
{
"id": null,
"date": "2026-04-09",
"project_id": 1,
"project": "Lighthouse Portal",
"task_id": 13,
"task": "Code review",
"description": "Review fuzzy matching",
"hours": 1.5,
"minutes": 90,
"employee": null,
"status": null,
"company": "Example Consulting",
"dry_run": true,
"duplicates": [
{
"id": 4018,
"date": "2026-04-09",
"project_id": 1,
"project": "Lighthouse Portal",
"task_id": 13,
"task": "Code review",
"description": "Review fuzzy matching",
"hours": 1.5,
"minutes": 90,
"employee": "Alex Demo",
"status": "draft",
"company": "Example Consulting"
}
]
}
Let the agent experiment safely¶
Point it at the fake backend:
Same commands, same JSON, same error kinds, made-up data.
1Password¶
If your config uses [op_secrets] and 1Password is locked, every command
fails after about 5 seconds with secrets_locked. The agent should stop and
ask you to unlock it. To run without 1Password, see
Test without Odoo.