Skip to main content

SnapOdoo: hot reload for Odoo 19. Save. It's live. No restart.

CI PyPI VS Code Marketplace Open VSX JetBrains Marketplace
Python 3.10+ Odoo 19 License: LGPL-3.0

Save a Python file, and your running Odoo 19 server uses the new code, without a restart.
Plus XML/XPath linting that understands Odoo view inheritance. For VS Code, Cursor and PyCharm.

Installation · How it works · Safety · Troubleshooting · Contributing


🎬 Demo GIF coming soon: edit → save → ⚡ [HOT] → the change is live in the browser.

✨ Why SnapOdoo?

Every Odoo developer knows the loop: change one line → restart the server → wait → log in again → click back to where you were. Dozens of times a day.

SnapOdoo replaces it for the most common change, editing the body of a method:

Traditional loop With SnapOdoo
Apply a method change Restart Odoo, wait for the registry to load Save. The code swap takes < 1 ms (0.79 ms mean, measured)
Back to testing Log in again, navigate back, reproduce the state Stay on the same page. Your session and data are untouched
A change that does need a restart You find out when something behaves oddly You're told before you save (⚠ WARM / COLD)
Broken XPath in an inherited view Error on module update (-u) Red underline while you type
Example day: 40 method edits, ~30 s per restart cycle ~20 min of waiting ~0 min

The "example day" is an illustration: plug in your own restart time and edit count. Measured on the live benchmark (Odoo 19, 8 concurrent clients, 40 patches): the swap takes 0.79 ms, a change is live in a median of 0.39 s while requests are in flight (the gate waits for them), and there were 0 mixed-version transactions.

🚀 Features

🔥 Hot patching on save Method bodies, added and removed methods, new imports. super(), name mangling and decorator-wrapped methods keep working.
🚦 Quiescence gate Waits for in-flight requests and cron jobs, so no transaction ever runs half old code and half new code.
↩️ Revert Undo any patch, newest first. A patch is all-or-nothing.
🔍 XML/XPath linter Broken XPath targets (checked against the parent arch as Odoo 19 combines it), unknown fields and XML IDs, missing depends.
🛠️ Odoo 19 quick fixes attrs / states → Python expressions, <tree> → <list>, view_mode, t-esc. One fix at a time, or the whole file.
🧭 Registry inspector A model's live MRO: which addon contributes which class, its fields, and which members are patched.
👁️ Visual checks (optional) A headless browser diffs a view's DOM and pixels before and after a change.
🔒 Safe by design Refuses production databases, accepts local authenticated connections only, masks PII before anything reaches your editor.

📦 Installation

SnapOdoo has two halves. Set up both (about 5 minutes):

Half Runs where Needed for
sabk_agent (Step 1) Inside your development Odoo 19 server Hot patching
Editor extension (Step 2) VS Code, Cursor or PyCharm Everything (XML linting works even without Step 1)

Requirements: Odoo 19.0, Python 3.10+, Linux or macOS (on Windows, use WSL).

Step 1: Odoo 19 server setup (sabk_agent)

1.1 Install the Python package into the Python that runs Odoo. It provides sabk_mask, which the agent needs:

# From PyPI:
/path/to/odoo-venv/bin/pip install snapodoo
# …or from the GitHub release:
/path/to/odoo-venv/bin/pip install https://github.com/yazanassad3/snapodoo/releases/download/v0.3.0/snapodoo-0.3.0-py3-none-any.whl

1.2 Put the sabk_agent addon on your addons_path. Pick one:

# a) From the GitHub release: unzip into a directory that is already on addons_path
cd /path/to/your/extra-addons
curl -LO https://github.com/yazanassad3/snapodoo/releases/download/v0.3.0/sabk_agent-19.0.1.0.0.zip
unzip sabk_agent-19.0.1.0.0.zip          # creates ./sabk_agent/

# b) Or clone the repository and add the clone itself to addons_path
git clone https://github.com/yazanassad3/snapodoo.git ~/snapodoo
#    odoo.conf:  addons_path = /path/to/odoo/addons,/path/to/your/addons,/home/<you>/snapodoo

1.3 Start Odoo in development mode with the agent switched on. Name the database(s) it may touch:

SABK_ENABLE=1 SABK_DB_ALLOWLIST=my_dev_db \
./odoo-bin -c odoo.conf -d my_dev_db \
    --workers=0 --dev=xml,qweb --load=base,rpc,web,sabk_agent
Flag Why
SABK_ENABLE=1 Explicit opt-in. Without it the agent stays inactive.
SABK_DB_ALLOWLIST=my_dev_db The only database(s) it may patch (comma-separated).
--workers=0 One process, so the patch reaches all of Odoo.
--dev=xml,qweb Dev mode. Not --dev=reload or all, which restart on every save.
--load=base,rpc,web,sabk_agent Odoo 19's default server-wide modules plus the agent.

1.4 Check the log. You should see these two lines:

INFO    odoo.addons.sabk_agent.server: sabk_agent listening on /run/user/1000/sabk/agent.sock
WARNING odoo.addons.sabk_agent: sabk_agent ACTIVE (dev only): socket=… token_file=… db=my_dev_db

If you see sabk_agent inactive: <reason> instead, the reason tells you which flag is missing (see Troubleshooting).

🐳 Odoo in Docker, or on another machine?
  • Docker: run the container with your own uid (--user "$(id -u):$(id -g)"). Bind-mount a socket directory (-v "$XDG_RUNTIME_DIR/sabk:/run/sabk") and set SABK_SOCKET=/run/sabk/agent.sock inside the container. Then, in the editor, set socket to $XDG_RUNTIME_DIR/sabk/agent.sock (written out in full) and Path map (sabk.pathMap) to HOST=CONTAINER prefixes, for example /home/me/addons=/mnt/extra-addons. If the uids differ, allow yours with SABK_ALLOW_UIDS.
  • Staging host: bridge the agent's socket to your laptop without opening a port. Use sabkd remote ssh user@host --remote-socket … --local-socket … (OpenSSH socket forwarding), or sabkd remote init / serve / connect for mutual TLS. The token check, the sandbox and masking still apply end to end.

Step 2: Editor setup

🟦 VS Code
  1. Install: open the Extensions view (Ctrl+Shift+X), search SnapOdoo and click Install. Offline: download snapodoo-0.3.0.vsix from the latest release, then

    code --install-extension snapodoo-0.3.0.vsix
    
  2. Open your addons folder (any folder that contains a __manifest__.py).

  3. First run: if SnapOdoo says it needs pygls and lxml, click Install Automatically. It creates a private virtualenv just for SnapOdoo. Nothing is installed globally.

  4. Verify: the status bar (bottom left) shows ⚡ ready · 0 patches. Hover for details, click for the menu.

🟪 Cursor
  1. Install: Cursor uses the Open VSX registry. In the Extensions view (Ctrl+Shift+X), search SnapOdoo and click Install. Offline: download the .vsix from the latest release, then

    cursor --install-extension snapodoo-0.3.0.vsix
    
  2. Steps 2 to 4 are the same as for VS Code: open your addons, accept Install Automatically if asked, and look for ⚡ ready · 0 patches.

  3. For teams: commit this as .vscode/extensions.json in your addons repository. VS Code and Cursor will then suggest SnapOdoo to everyone who opens it:

    { "recommendations": ["snapodoo.snapodoo"] }
    
🟩 PyCharm (Community & Professional, 2024.1+)
  1. Install: go to Settings → Plugins → Marketplace, search SnapOdoo and click Install. Its dependency LSP4IJ (Red Hat's language-server client) is installed automatically. Restart the IDE. Offline: first install LSP4IJ from the Marketplace, because plugins installed from disk don't fetch their dependencies. Then go to Settings → Plugins → ⚙ → Install Plugin from Disk… and pick snapodoo-pycharm-0.3.0.zip from the latest release.
  2. Open your addons project. SnapOdoo starts when it finds a __manifest__.py.
  3. First run: if a balloon says Python dependencies are missing, click Install Automatically.
  4. Verify: the status bar (bottom right) shows ⚡ ready · 0 patches.
Where / key What
Tools → SnapOdoo Revert Last Patch, Inspect Running Registry…, Toggle Zen Mode, Restart Language Server, Rebuild Addons Index, visual checks, Show Log
Click the status bar item The same menu
Alt+Enter XML quick fixes (Odoo 19 rewrites)
Ctrl+Alt+Shift+Z Zen mode (Ctrl+Alt+Z is PyCharm's Rollback)
Settings → Tools → SnapOdoo Settings (per project; the visual-check password is kept in the IDE password safe)

Configuration is usually unnecessary. SnapOdoo reads addons_path from odoo.conf or .odoorc in the project root, then $ODOO_RC, then ~/.odoorc, so the linter knows Odoo core fields and views. If your config is elsewhere, set odoo.conf (sabk.odooConf). If you changed SABK_SOCKET, set the agent socket and token file to match.

Step 3: Your first hot patch (30 seconds)

  1. With Odoo running (Step 1) and your addons open (Step 2), check the status bar: ⚡ ready · 0 patches. Hover it: it should say Agent: pid …, Odoo 19.0, db my_dev_db.

  2. Open any model file in your addon and change the body of a method you can trigger from the UI. A button action is ideal, for example:

    def action_confirm(self):
        _logger.info("SnapOdoo says hi")   # ← add a line like this
        return super().action_confirm()
    
  3. Save (Ctrl+S). The status bar turns into ⚡ 0.79ms [HOT] · 1 patch (your number will differ).

  4. Click the button in Odoo, without restarting. The new code runs.

  5. Optional: run SnapOdoo: Revert Last Patch. The old code runs again; your file is untouched.

Now add a field (x = fields.Char()) to the same class. SnapOdoo shows ⚠ COLD before you save, because that change needs a restart or -u. Delete the field again.


🧠 How it works

sequenceDiagram
    autonumber
    actor Dev as You
    participant Ed as Editor<br/>(VS Code · Cursor · PyCharm)
    participant Sd as sabkd<br/>language server
    box rgba(113,75,103,0.25) sabk_agent, inside the Odoo 19 process
        participant Sb as Sandbox
        participant Gt as Quiescence gate
        participant In as Injector
    end
    Dev->>Ed: edit a method
    Ed->>Sd: LSP didChange
    Sd-->>Ed: diagnostics (XPath, fields, ⚠ WARM/COLD before you save)
    Dev->>Ed: Ctrl+S
    Ed->>Sd: LSP didSave
    Sd->>Sd: AST diff vs. the code Odoo is running → HOT?
    Sd->>Sb: apply (Unix socket 0600 + token)
    Sb->>Sb: every loaded DB allowlisted, none production-like
    Sb->>Gt: ok
    Gt->>Gt: wait for in-flight requests & crons, hold new ones
    Gt->>In: exclusive
    In->>In: compile + swap methods in place (< 1 ms), reset memos, evict caches
    In-->>Sd: result (PII-masked before it leaves Odoo)
    Sd-->>Ed: ⚡ 0.79ms [HOT] · 1 patch

Each saved file is classified by its most demanding change. The classifier is conservative: anything it doesn't positively recognize as safe escalates.

Tier Example What happens
NOOP comments, whitespace, docstrings nothing
HOT a method body; a method added or removed patched live, in place
WARM changed @api.depends / @api.constrains, @http.route controllers flagged: restart the server
COLD fields, _name / _inherit, new classes, __manifest__.py flagged: -u or restart

SnapOdoo always diffs against the code Odoo is actually running, not the last version saved on disk. After a WARM or COLD save it keeps reporting "needs restart" (↻ in the status bar). It never assumes the server picked up a change it didn't.

🔒 Safety guarantees

SnapOdoo changes a live process, so it is deliberately hard to point at the wrong one:

  • Inert unless explicitly enabled. The agent starts only with SABK_ENABLE=1, --workers=0, a --dev mode without reload, and every database in SABK_DB_ALLOWLIST. Otherwise it logs one line and does nothing.
  • Refuses production, on every patch. All loaded databases are re-checked. A database is refused if it isn't allowlisted, is marked sabk.environment = production, has an enterprise subscription without having been neutralized, or has a production-like name (prod, live, …).
  • Local and authenticated. The agent uses a Unix socket only (directory 0700, socket 0600), never TCP. The peer's uid is verified on Linux, and a secret token is required (compared in constant time).
  • No mixed transactions. The quiescence gate guarantees that each request runs entirely on old code or entirely on new code. A patch is atomic and revertible.
  • PII never leaves Odoo unmasked. Names, emails, phones, VAT numbers, IBANs and card numbers become deterministic, format-valid fakes. Passwords, tokens and keys are redacted. The editor side masks everything a second time.

Details, and how to report a vulnerability privately: SECURITY.md.

🔍 XML lint codes

All checks run on the unsaved buffer as you type.

Code Meaning
xpath-not-found The spec target is missing from the parent arch, combined as Odoo 19 does it (depth-first from the root view, ordered by priority and id, limited to this module's dependency closure).
xpath-needs-dependency The target exists only if a module outside depends is installed. The message names it.
xpath-syntax, xpath-eval, move-not-found, invalid-position, … The inheritance spec itself is invalid.
unknown-field The field doesn't exist on the view's model, or on the comodel inside x2many subviews.
unknown-view, unknown-xmlid Unknown inherit_id, ref=, ref('…'), groups=, %(…)d, t-call, menu parent or action.
obsolete-attrs, obsolete-states, tree-tag, view-mode-tree, deprecated-t-esc Constructs Odoo 19 rejects or deprecates. Each has a quick fix.
hot-warm, hot-cold (Python) A change that can't be hot-patched, compared with the code the server is running.

⌨️ Command line

The same engine also works without an editor (pip install snapodoo provides the sabkd command):

sabkd watch --addons ~/src/my_addons     # hot-patch on save from a terminal (stdin: journal | revert <id> | stale | status)
sabkd lint views.xml --odoo-conf odoo.conf --workspace ~/src/my_addons   # exit code 1 on errors (CI-friendly)
sabkd status | journal | revert <id>     # query or control the running agent
sabkd verify my_module.view_partner_form --url http://127.0.0.1:8069 --db my_dev_db   # visual check
sabkd read res.partner --fields name,email      # read records through the agent (masked, read-only)
sabkd remote ssh user@staging --remote-socket /run/user/1001/sabk/agent.sock --local-socket ~/.sabk/staging.sock

🩺 Troubleshooting

Status bar says "agent offline"

The editor can't reach sabk_agent. Check in order:

  1. Is Odoo running, and does its log show sabk_agent ACTIVE? If it shows sabk_agent inactive: …, fix the reason it names: missing SABK_ENABLE=1, --workers not 0, --dev=reload, or a database not in SABK_DB_ALLOWLIST.
  2. Socket location: the agent logs sabk_agent listening on <path>. If that isn't $XDG_RUNTIME_DIR/sabk/agent.sock, set the editor's socket (sabk.socketPath) and token file (sabk.tokenFile, agent.token next to the socket) to the logged path.
  3. Docker: see the Docker notes in Step 1.
⚠ WARM / COLD: "was not hot-patched"

Not a bug. The change can't be applied safely to a running server. WARM (decorator changes, new @api.constrains, controllers): restart Odoo. COLD (fields, _inherit, new models, __manifest__.py): update the module (-u my_module) or restart. The ↻ N counter in the status bar shows how many files are waiting for a restart.

"DEFERRED: requests kept the gate busy"

A long request or cron job was still running when the patch waited (1.5 s by default). Nothing was changed. Save again, or raise sabk.quiesceTimeoutMs.

"Patch refused by the database sandbox"

A loaded database isn't in SABK_DB_ALLOWLIST or looks like production. Use a dedicated, neutralized development database. If a dev database's name merely looks like production, set the system parameter sabk.environment = development in it.

"SnapOdoo needs Python 3.10+ with pygls (<2) and lxml"

Click Install Automatically (or run the Install Python Dependencies command). To use your own interpreter, set Python interpreter (sabk.pythonPath) to a Python 3.10+ that has pygls>=1.3,<2 and lxml. pygls 2 is not supported yet.

The linter flags core fields or views as unknown

The index doesn't include Odoo core. Set odoo.conf (sabk.odooConf) to the config whose addons_path lists Odoo's addons, then run Rebuild Addons Index.

PyCharm: no status bar item

The project must contain a __manifest__.py, and LSP4IJ must be installed and enabled. Use Tools → SnapOdoo → Restart Language Server to start it manually, and Show Log to see why it stopped.

⚠️ Limitations

  • Odoo 19.0 only. The injector relies on Odoo 19's model composition.
  • Single-process mode (--workers=0). With prefork workers, each worker has its own copy of the code.
  • Only HOT changes are applied live. Everything else is flagged with what to do instead.

🤝 Contributing

Bug reports, ideas and pull requests are welcome. Start with CONTRIBUTING.md (dev setup and tests) and DEVELOPMENT.md (internals and the live benchmark). Please follow the Code of Conduct, and report security issues privately (SECURITY.md).

📄 License

LGPL-3.0, the same license as Odoo Community.

Metadata

Release files for snapodoo 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for snapodoo 0.3.0
File Interpreter ABI Platform Actions
snapodoo-0.3.0-py3-none-any.whl Python 3 none any Details for snapodoo-0.3.0-py3-none-any.whl

Release files / snapodoo-0.3.0-py3-none-any.whl

Download URL snapodoo-0.3.0-py3-none-any.whl
Size 119.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01c794fc7c13dc4ff41ad3c15f97f410bdfa3406575c90fa361fc7244377d587
BLAKE2b-256 checksum
How to use checksums
a8a6893e9272540775a86664c4f808ddb439d41ce0a26371f7bf54d4e7412dfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for snapodoo 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page