Use the real Odoo 19 external API (JSON-2), and batch calls
The previous commit moved to /jsonrpc, which the v19 docs list as deprecated
alongside /xmlrpc — both go away in Odoo 22. The actual v19 external API is
JSON-2: POST /json/2/<model>/<method>, API key as a bearer token.
Three consequences, all of which change calling code:
- no uid and no password; UID now comes from res.users/context_get
- every argument is named, positional args do not exist, so x() becomes
x(model, method, ids=None, **kwargs) and callers pass domain=/vals=/fields=
- one call is one transaction and nothing chains, which is the mechanical
reason state changes must go through a button method
Batching: no multi-call envelope exists, so batching means widening a call, not
bundling calls. Added get_or_create_many() (one search_read + one create for a
whole set) and put build_demo.py's product, customer, vehicle, invoice and
headroom loops through set-based calls.
test_odoo_connect.py checks the call shape and the batching offline, with a
faked urlopen — none of this can be exercised without a live instance otherwise.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
3fd2c51a3d
commit
93edf9296e
@@ -44,9 +44,11 @@ same-named fork silently shadows upstream depending on install order.
|
||||
|
||||
## Quickstart
|
||||
|
||||
1. Put your Odoo creds in env vars (or `scripts/creds.json`):
|
||||
`ODOO_URL`, `ODOO_DB`, `ODOO_LOGIN`, `ODOO_KEY`.
|
||||
2. Verify the connection: `python scripts/odoo_connect.py` → prints `server_version`.
|
||||
1. Put your Odoo creds in env vars (or `scripts/creds.json`): `ODOO_URL`, `ODOO_KEY`, and
|
||||
`ODOO_DB` if one domain serves several databases. JSON-2 authenticates on the API key
|
||||
alone — there is no login/password, so no `ODOO_LOGIN`.
|
||||
2. Verify the connection: `python scripts/odoo_connect.py` → prints the server version and uid.
|
||||
(`python scripts/test_odoo_connect.py` checks the call shape offline, no server needed.)
|
||||
3. Copy `demo_config.example.json` → `scripts/demo_config.json`, fill it from the brief.
|
||||
4. Ask Claude to run the pipeline (see [`SKILL.md`](SKILL.md)).
|
||||
|
||||
@@ -61,8 +63,9 @@ Several core fields were renamed in v19 (`res.users.group_ids`, `res.groups` los
|
||||
```
|
||||
SKILL.md the procedure (what the agent follows)
|
||||
UPSTREAM.md fork point + divergence from upstream
|
||||
scripts/odoo_connect.py JSON-RPC connector + helpers
|
||||
scripts/odoo_connect.py JSON-2 connector + helpers
|
||||
scripts/build_demo.py config-driven data + hero builder (template)
|
||||
scripts/test_odoo_connect.py offline self-check of the JSON-2 call shape
|
||||
demo_config.example.json per-client config shape
|
||||
reference/odoo19-field-gotchas.md version-specific fields + footguns
|
||||
templates/ brand.css + the doc templates
|
||||
|
||||
Reference in New Issue
Block a user