Typed Odoo JSON-RPC client for Node.js with read_group support. Zero runtime dependencies.
npm install odoo-nodeimport { OdooClient } from "odoo-node";
// Authenticate first (one-time)
const uid = await OdooClient.authenticate({
url: "https://your-odoo.com",
db: "production",
login: "admin",
apiKey: "your-api-key",
});
// Create client
const client = new OdooClient({
url: "https://your-odoo.com",
db: "production",
uid,
apiKey: "your-api-key",
});
// Query data
const { records, total } = await client.searchRead("sale.order", [
["state", "=", "sale"],
], { fields: ["name", "amount_total", "partner_id"], limit: 10 });
// Server-side aggregation
const { groups } = await client.readGroup(
"sale.order",
[["state", "=", "sale"]],
["partner_id", "amount_total:sum"],
["partner_id"],
);Authenticate with Odoo and get the user ID. Returns uid: number.
Create a client. Config: { url, db, uid, apiKey }.
version()— Server version infomodels()— List all models with human-readable namesfields(model)— Field definitions for a model
searchRead(model, domain, options?)— Query records. Returns{ records, total, limit, offset }.searchCount(model, domain)— Count matching records.readGroup(model, domain, fields, groupby, options?)— Server-side aggregation with sum, avg, min, max.
create(model, values)— Create record, returns ID.write(model, ids, values)— Update records.unlink(model, ids)— Delete records.
callMethod(model, method, args?, kwargs?)— Invoke an arbitrary model method viaexecute_kw. The generic escape hatch behind the typed helpers, for record methods without a dedicated wrapper (e.g.client.callMethod("mail.activity", "action_feedback", [[id]], { feedback: "Done" })). For methods that operate on a recordset, the first element ofargsis the list of record ids.
Standard Odoo domain syntax: [["field", "operator", value]]
Operators: =, !=, >, >=, <, <=, in, not in, like, ilike
Logic: & (AND, default), | (OR), ! (NOT) — Polish notation.
Works with Odoo 14+ (Community and Enterprise). Uses JSON-RPC with API key authentication.
MIT — Clemens Helm