odoo-lens
v0.1.2
Published
A CLI for reading data from an Odoo instance via the XML-RPC API. Best use with LLM agents.
Readme
odoo-lens
A small TypeScript client + CLI for reading data from an Odoo instance via the XML-RPC API.
The higher-level goal is to make it easy for LLMs and coding agents (and humans) to fetch structured Odoo data on demand, so they can answer questions like:
- What is the current status of order
EC-...? - Which picking is blocking shipment?
- What fields exist on a model?
Usage
You can run odoo-lens directly via npx without installing it.
npx odoo-lens list-models --like sale.orderSearch and read records:
npx odoo-lens search-read sale.order '["&",["name","=","EC-2441218"]]' --fields '["name","state"]' --limit 1(You can also install it globally via npm install -g odoo-lens and run odoo-lens version)
Configuration
odoo-lens needs connection details to communicate with your Odoo instance.
By default, it looks for environment variables, a .env file, and a .env.local file (which overrides .env) in your current working directory.
Required keys:
ODOO_URL(orurl)ODOO_DB(ordatabase)ODOO_USERNAME(orusername)ODOO_PASSWORD(orpassword)
Example .env.local:
ODOO_URL=https://my-odoo.example.com
ODOO_DB=my_database
ODOO_USERNAME=admin
ODOO_PASSWORD=supersecretYou can specify a custom env file:
npx odoo-lens --dotenv ./.env.prod versionDirect-IP / self-signed TLS mode
If your Odoo instance is behind a WAF/Cloudflare on the public hostname, you may need to use direct IP access:
ODOO_URL=https://34.44.44.444ODOO_XMLRPC_INSECURE_TLS=trueODOO_XMLRPC_SERVERNAME=portal.example.com
Notes:
ODOO_XMLRPC_INSECURE_TLS=truedisables TLS certificate verification (required for self-signed certs).ODOO_XMLRPC_SERVERNAMEis used for TLS SNI and will also be sent as the HTTPHostheader.
Local Development
If you want to contribute or modify odoo-lens locally:
- Clone the repository
- Install dependencies:
pnpm install - Create your
.env.local
Run the CLI via the source files:
pnpm dev -- version
pnpm dev -- list-models --like stock.pickingTesting & Building
Run tests and typecheck:
pnpm test
pnpm typecheckBuild the project:
pnpm buildVerify release readiness (runs typecheck, tests, and build):
pnpm release:checkSecurity
- Never commit
.envor.env.local. - Prefer environment variables for CI.
