Odoo Time Tracker for VS Code
Connects to your Odoo server via the External API (JSON-RPC), shows projects and tasks in the sidebar, and lets you track time right from the editor — with a live timer or manual entries. It also automates the Git workflow: check out convention-compliant feature branches from a ticket, create a draft PR on GitHub, and link it back to the Odoo ticket.
Features
Projects & tasks
- Project/task tree in the Activity Bar (Odoo icon)
- Filter to tasks assigned to you (
odoo.onlyMyTasks, default on)
- Projects without visible tasks are hidden (
odoo.hideEmptyProjects, default on)
- Task search, open tasks/projects in the browser
Time tracking
- Timer: right-click a task → Start timer. The elapsed time is shown in the status bar. Clicking it opens a menu:
- Stop & log — asks for a description and creates a timesheet entry (
account.analytic.line)
- Edit time — correct the running time (e.g.
1:30, 90m, 1.5); the timer keeps running from the new value
- Discard — stop without logging anything
- Manual entry: log a duration directly (
1:30, 90m, or 1.5)
- The timer survives VS Code restarts
Git & GitHub integration
- Check out a feature branch from a ticket. The suggested name follows the convention
feature/<ticket-id>-<name> (regex ^feature\/\d+\-[\-a-zA-Z]*$); umlauts, digits, and special characters in the task name are sanitized. The name is editable and validated before checkout.
- Create a draft PR & link it in the ticket: pushes the branch, creates a draft pull request via the GitHub API (title
#<id> <task name>, body links back to the Odoo ticket), and automatically posts the PR URL to the ticket's chatter. Ticket and PR reference each other.
- If an open PR already exists for the branch, its URL is reused.
- Configurable base branch per repository (
odoo.prBaseBranch, e.g. 17.0 or develop); empty = the repo's default branch.
- Without a GitHub token, a browser fallback opens the pre-filled compare page instead.
Security
- The Odoo API key and the GitHub token are stored in VS Code SecretStorage (OS keychain), never in settings files.
Requirements
- Odoo 14+ with the Project and Timesheets (
hr_timesheet) apps installed
- The Odoo user should be linked to an employee (
hr.employee) so timesheet lines are attributed correctly
- Odoo API key: in Odoo, go to your avatar → My Profile → Account Security → New API Key
- For the PR automation: a GitHub fine-grained personal access token scoped to your repositories with Pull requests: Read and write
Setup
- Install the extension (see below)
- Run “Odoo: Anmelden / API-Key setzen” from the command palette — it asks for server URL, database, username, and API key
- Optional, for PR automation: run “Odoo: GitHub-Token setzen”
Settings
| Setting |
Description |
Default |
odoo.url |
Base URL of the Odoo server, e.g. https://mycompany.odoo.com |
– |
odoo.database |
Database name |
– |
odoo.username |
Login (email) |
– |
odoo.onlyMyTasks |
Only show tasks assigned to me |
true |
odoo.hideEmptyProjects |
Hide projects without visible tasks |
true |
odoo.taskLimit |
Max. tasks per project |
100 |
odoo.prBaseBranch |
Base branch for draft PRs (e.g. 17.0). Empty = repo default branch. Tip: set per repo in .vscode/settings.json |
"" |
Installation
Grab the .vsix from the releases page and run:
code --install-extension odoo-time-tracker-x.y.z.vsix
Or in VS Code: Extensions view → … → Install from VSIX…
Development
npm install
npm run compile # or: npm run watch
Open the folder in VS Code and press F5 to launch the Extension Development Host.
Build a VSIX locally:
npx vsce package
CI / Releases
Every push runs a build via GitHub Actions and uploads the .vsix as an artifact. Pushing a tag like v0.4.0 creates a GitHub release with the .vsix attached:
git tag v0.5.0 && git push origin v0.5.0
Technical notes
- Talks to Odoo via
POST {url}/jsonrpc using common.login and object.execute_kw — no runtime dependencies (uses the fetch built into VS Code's Node runtime)
- Logging time creates an
account.analytic.line with task_id, project_id, unit_amount (decimal hours), name (description), and employee_id
- Handles the
planned_hours → allocated_hours rename introduced in Odoo 17 (tries both)
- Empty-project filtering with
onlyMyTasks uses a read_group on project.task, so the task counts shown per project are your tasks
- Self-hosted servers with self-signed certificates will fail
fetch — use a valid certificate (e.g. Let's Encrypt)
License
MIT
| |