Skip to content

Repository files navigation

pi-odoo-develop

pi-odoo-develop

Version-aware Odoo development for the Pi coding agent.

Guarantees the Odoo version is known before any line of Odoo code is written.

A version-aware Odoo development extension for the Pi coding agent.

It guarantees that the Odoo version is known before any Odoo code is written, then redirects the agent to the official Odoo docs, ORM changelog, and OCA migration guide for the confirmed major (it does not try to maintain a hand-curated change list — Odoo changes too much per release). Supports Odoo 14–19.

This complements Odoo knowledge skills (odoo-19, odoo-code-review, …): those provide knowledge, this extension enforces runtime version awareness.

Why

Writing Odoo code without confirming the major version leads to subtle bugs — Odoo changes a lot between releases (view tags, removed fields, ORM API shifts, security model changes, …). Rather than hardcoding a partial change list, this extension makes the agent stop and confirm the version first, then point at the official changelog and docs for that major.

What it does

  • Strict gate (two steps): blocks write/edit on Odoo code files (.py/.xml/.csv/.po/.pot inside a module with a __manifest__.py) until BOTH conditions hold: (1) a version is confirmed, AND (2) the agent has researched the official sources for that major in the current session (via odoo_changelog or odoo_version with detect). This guarantees every proposed change is grounded in the version's official changelog/docs before it is written.
  • Docker lifecycle commands: manage your Odoo instance directly from Pi.
    • /odoo-status: Show Odoo project status, version gate state, and active Docker service.
    • /odoo-restart: Restart the Odoo service.
    • /odoo-update <modules>: Update Odoo modules (-u).
    • /odoo-logs: Tail the Odoo service logs.
  • Auto-detection of the Odoo version from multiple sources (Docker Compose first).
  • Official-sources router: once a version is known, the system prompt gets the official docs, ORM changelog, and OCA migration-guide URLs for that major.
  • No-op outside Odoo projects: safe to load anywhere.

How the gate works

For write/edit on an Odoo code file (per session):

  1. No version confirmed → blocked. Run /odoo-version (or /odoo-version set <major>) or call odoo_version.
  2. Version confirmed, but not researched this session → blocked. Call odoo_changelog (recommended) or odoo_version { action: "detect" } so the change is grounded in the version's official changelog.
  3. Version confirmed AND researched → writes allowed (for the rest of the session; re-detection after /odoo-version clear re-arms the gate).

The .pi/ directory is always exempt, so /odoo-version set can always write its config.

Install

# From npm (shows up in the pi.dev gallery)
pi install npm:pi-odoo-develop

# From GitHub
pi install git:github.com/vigbe/pi-odoo-develop

# Try it in the current project only (no install)
pi -e ./src/index.ts

It is distributed as a Pi package — see package.json (pi manifest key).

Usage

/odoo-version command

/odoo-version            # show the detected version + source
/odoo-version detect     # force re-detection
/odoo-version set 17     # manual override (saved to .pi/odoo.json)
/odoo-version clear      # remove the override

Docker lifecycle & status commands

Manage your Odoo instance directly from the Pi console:

/odoo-status           # Show gate state, version, and Docker status
/odoo-restart          # Restart the Odoo service
/odoo-update all       # Update all modules
/odoo-update sale,stock # Update specific modules (-d dbname optional)
/odoo-logs --tail=50   # Show the last 50 lines of logs

The extension automatically finds your Odoo service in docker-compose.yml (prioritizing services named odoo or web).

odoo_version tool (for the agent)

The agent should call this before writing or reviewing Odoo code:

odoo_version { action: "detect" }   # auto-detect
odoo_version { action: "show" }     # read cached
odoo_version { action: "set", version: "17" }   # manual override

Returns the confirmed major and the official docs, ORM changelog, and OCA migration-guide URLs for it.

odoo_changelog tool (for the agent)

Fetches the official Odoo ORM changelog for the confirmed major on demand, so the agent can apply version-correct APIs straight from the source of truth (no manual change list to maintain):

odoo_changelog {}              # changelog for the detected major
odoo_changelog { major: 17 }   # changelog for a specific major

For Odoo 14/15 (which have no dedicated changelog page), it falls back to the OCA migration guide for that major, with a note explaining the fallback.

How version detection works

Sources are tried in priority order; the first success is cached to .pi/odoo.json:

  1. Manual override (.pi/odoo.json with source: "manual") — always honoured.
  2. Docker Compose runtime: docker compose exec <odoo-service> python -c "import odoo.release; print(odoo.release.version)".
  3. Docker image tag: image: odoo:17.0 parsed from docker compose config.
  4. Repo source: ./odoo-bin --version or odoo/release.py.
  5. base manifest: version field in base/__manifest__.py.

Detection runs automatically once per session when the agent starts in an Odoo project. A manual override is never overwritten by automatic detection.

Supported majors

14, 15, 16, 17, 18, 19. Unknown/future majors degrade gracefully: detection still works and the gate lifts, but no version-specific banner is injected.

Configuration

File Purpose
.pi/odoo.json Cached/manual version override, written by the extension.

Roadmap (v3)

Interactive shell support:

  • /odoo-shelldocker compose exec <svc> odoo shell

Development & Testing

Run unit tests locally using the Node.js test runner:

npm test

License

LGPL-3.0-or-later

About

Version-aware Odoo development for the Pi coding agent — guarantees the Odoo version is known before any code is written.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages