productivity
Odoo ERP Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Odoo ERP KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.odoo.*.
Use lua_read_doc("integrations.odoo") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
Odoo ERP workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.odoo.list_contacts({page = 1, limit = 1, name = "example_name", email = "example_email", is_company = true}))' --json kosmo integrations:lua --eval 'print(docs.read("odoo"))' --json
kosmo integrations:lua --eval 'print(docs.read("odoo.list_contacts"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local odoo = app.integrations.odoo
local result = odoo.list_contacts({page = 1, limit = 1, name = "example_name", email = "example_email", is_company = true})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.odoo, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.odoo.default.* or app.integrations.odoo.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Odoo ERP, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
Odoo ERP — Lua API Reference
list_contacts
List contacts (customers, vendors) from Odoo with pagination.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (default: 1) |
limit | integer | no | Results per page (default: 20, max: 100) |
name | string | no | Filter by name (partial match) |
email | string | no | Filter by email (partial match) |
is_company | boolean | no | true for companies only, false for individuals |
Example
local result = app.integrations.odoo.list_contacts({
page = 1,
limit = 20,
name = "Acme"
})
for _, contact in ipairs(result.contacts) do
print(contact.name .. " — " .. (contact.email or "no email"))
end
get_contact
Get full details of a specific Odoo contact by ID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The Odoo contact ID |
Example
local result = app.integrations.odoo.get_contact({ id = 42 })
print(result.name)
print(result.email)
print(result.phone)
create_contact
Create a new contact (customer or vendor) in Odoo.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | yes | Full name of the contact |
email | string | no | Email address |
phone | string | no | Phone number |
is_company | boolean | no | Whether this is a company (default: false) |
company_type | string | no | "company" or "person" (default: "person") |
street | string | no | Street address |
city | string | no | City |
zip | string | no | Postal / ZIP code |
country | string | no | Country name or code |
website | string | no | Website URL |
vat | string | no | Tax ID / VAT number |
type | string | no | Contact type: "contact", "invoice", "delivery", "other" |
parent_id | integer | no | Parent company ID |
function | string | no | Job position / title |
Example
local result = app.integrations.odoo.create_contact({
name = "Acme Corp",
email = "info@acme.com",
is_company = true,
country = "US",
vat = "US123456789"
})
print("Created contact ID: " .. result.id)
list_sales_orders
List sales orders from Odoo with pagination and filtering.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (default: 1) |
limit | integer | no | Results per page (default: 20, max: 100) |
status | string | no | Filter by status: "draft", "sent", "sale", "done", "cancel" |
partner_id | integer | no | Filter by customer (partner) ID |
date_from | string | no | From date (ISO 8601, e.g., "2025-01-01") |
date_to | string | no | To date (ISO 8601, e.g., "2025-12-31") |
Example
local result = app.integrations.odoo.list_sales_orders({
status = "sale",
page = 1,
limit = 10
})
for _, order in ipairs(result.orders) do
print(order.name .. " — " .. order.amount_total)
end
list_invoices
List invoices from Odoo with pagination and filtering.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (default: 1) |
limit | integer | no | Results per page (default: 20, max: 100) |
status | string | no | Filter by status: "draft", "posted", "cancel" |
partner_id | integer | no | Filter by customer (partner) ID |
date_from | string | no | From date (ISO 8601) |
date_to | string | no | To date (ISO 8601) |
Example
local result = app.integrations.odoo.list_invoices({
status = "posted",
date_from = "2025-01-01",
date_to = "2025-03-31"
})
for _, invoice in ipairs(result.invoices) do
print(invoice.name .. " — " .. invoice.amount_total)
end
list_products
List products from Odoo with pagination and filtering.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (default: 1) |
limit | integer | no | Results per page (default: 20, max: 100) |
name | string | no | Filter by name (partial match) |
category | string | no | Filter by product category |
type | string | no | Filter by type: "consumable", "service", "product" |
sale_ok | boolean | no | Can be sold |
purchase_ok | boolean | no | Can be purchased |
Example
local result = app.integrations.odoo.list_products({
category = "Software",
limit = 50
})
for _, product in ipairs(result.products) do
print(product.name .. " — " .. product.list_price)
end
list_leads
List CRM leads and opportunities from Odoo.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (default: 1) |
limit | integer | no | Results per page (default: 20, max: 100) |
type | string | no | Filter by type: "lead" or "opportunity" |
stage | string | no | Filter by stage: "New", "Qualified", "Won", "Lost" |
user_id | integer | no | Filter by assigned salesperson |
partner_id | integer | no | Filter by customer (partner) ID |
Example
local result = app.integrations.odoo.list_leads({
type = "opportunity",
stage = "Qualified"
})
for _, lead in ipairs(result.leads) do
print(lead.name .. " — " .. (lead.expected_revenue or "0"))
end
get_current_user
Get the currently authenticated Odoo user profile.
Parameters
None.
Example
local result = app.integrations.odoo.get_current_user({})
print("Logged in as: " .. result.name)
print("Email: " .. result.email)
print("Company: " .. result.company_id)
Multi-Account Usage
If you have multiple Odoo instances configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.odoo.list_contacts({})
-- Explicit default (portable across setups)
app.integrations.odoo.default.list_contacts({})
-- Named accounts
app.integrations.odoo.production.list_contacts({})
app.integrations.odoo.staging.list_contacts({})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Odoo ERP — Lua API Reference
## list_contacts
List contacts (customers, vendors) from Odoo with pagination.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `limit` | integer | no | Results per page (default: 20, max: 100) |
| `name` | string | no | Filter by name (partial match) |
| `email` | string | no | Filter by email (partial match) |
| `is_company` | boolean | no | `true` for companies only, `false` for individuals |
### Example
```lua
local result = app.integrations.odoo.list_contacts({
page = 1,
limit = 20,
name = "Acme"
})
for _, contact in ipairs(result.contacts) do
print(contact.name .. " — " .. (contact.email or "no email"))
end
```
---
## get_contact
Get full details of a specific Odoo contact by ID.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The Odoo contact ID |
### Example
```lua
local result = app.integrations.odoo.get_contact({ id = 42 })
print(result.name)
print(result.email)
print(result.phone)
```
---
## create_contact
Create a new contact (customer or vendor) in Odoo.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Full name of the contact |
| `email` | string | no | Email address |
| `phone` | string | no | Phone number |
| `is_company` | boolean | no | Whether this is a company (default: false) |
| `company_type` | string | no | `"company"` or `"person"` (default: `"person"`) |
| `street` | string | no | Street address |
| `city` | string | no | City |
| `zip` | string | no | Postal / ZIP code |
| `country` | string | no | Country name or code |
| `website` | string | no | Website URL |
| `vat` | string | no | Tax ID / VAT number |
| `type` | string | no | Contact type: `"contact"`, `"invoice"`, `"delivery"`, `"other"` |
| `parent_id` | integer | no | Parent company ID |
| `function` | string | no | Job position / title |
### Example
```lua
local result = app.integrations.odoo.create_contact({
name = "Acme Corp",
email = "info@acme.com",
is_company = true,
country = "US",
vat = "US123456789"
})
print("Created contact ID: " .. result.id)
```
---
## list_sales_orders
List sales orders from Odoo with pagination and filtering.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `limit` | integer | no | Results per page (default: 20, max: 100) |
| `status` | string | no | Filter by status: `"draft"`, `"sent"`, `"sale"`, `"done"`, `"cancel"` |
| `partner_id` | integer | no | Filter by customer (partner) ID |
| `date_from` | string | no | From date (ISO 8601, e.g., `"2025-01-01"`) |
| `date_to` | string | no | To date (ISO 8601, e.g., `"2025-12-31"`) |
### Example
```lua
local result = app.integrations.odoo.list_sales_orders({
status = "sale",
page = 1,
limit = 10
})
for _, order in ipairs(result.orders) do
print(order.name .. " — " .. order.amount_total)
end
```
---
## list_invoices
List invoices from Odoo with pagination and filtering.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `limit` | integer | no | Results per page (default: 20, max: 100) |
| `status` | string | no | Filter by status: `"draft"`, `"posted"`, `"cancel"` |
| `partner_id` | integer | no | Filter by customer (partner) ID |
| `date_from` | string | no | From date (ISO 8601) |
| `date_to` | string | no | To date (ISO 8601) |
### Example
```lua
local result = app.integrations.odoo.list_invoices({
status = "posted",
date_from = "2025-01-01",
date_to = "2025-03-31"
})
for _, invoice in ipairs(result.invoices) do
print(invoice.name .. " — " .. invoice.amount_total)
end
```
---
## list_products
List products from Odoo with pagination and filtering.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `limit` | integer | no | Results per page (default: 20, max: 100) |
| `name` | string | no | Filter by name (partial match) |
| `category` | string | no | Filter by product category |
| `type` | string | no | Filter by type: `"consumable"`, `"service"`, `"product"` |
| `sale_ok` | boolean | no | Can be sold |
| `purchase_ok` | boolean | no | Can be purchased |
### Example
```lua
local result = app.integrations.odoo.list_products({
category = "Software",
limit = 50
})
for _, product in ipairs(result.products) do
print(product.name .. " — " .. product.list_price)
end
```
---
## list_leads
List CRM leads and opportunities from Odoo.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `limit` | integer | no | Results per page (default: 20, max: 100) |
| `type` | string | no | Filter by type: `"lead"` or `"opportunity"` |
| `stage` | string | no | Filter by stage: `"New"`, `"Qualified"`, `"Won"`, `"Lost"` |
| `user_id` | integer | no | Filter by assigned salesperson |
| `partner_id` | integer | no | Filter by customer (partner) ID |
### Example
```lua
local result = app.integrations.odoo.list_leads({
type = "opportunity",
stage = "Qualified"
})
for _, lead in ipairs(result.leads) do
print(lead.name .. " — " .. (lead.expected_revenue or "0"))
end
```
---
## get_current_user
Get the currently authenticated Odoo user profile.
### Parameters
None.
### Example
```lua
local result = app.integrations.odoo.get_current_user({})
print("Logged in as: " .. result.name)
print("Email: " .. result.email)
print("Company: " .. result.company_id)
```
---
## Multi-Account Usage
If you have multiple Odoo instances configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.odoo.list_contacts({})
-- Explicit default (portable across setups)
app.integrations.odoo.default.list_contacts({})
-- Named accounts
app.integrations.odoo.production.list_contacts({})
app.integrations.odoo.staging.list_contacts({})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.odoo.list_contacts({page = 1, limit = 1, name = "example_name", email = "example_email", is_company = true})
print(result) Functions
list_contacts Read
List contacts (customers, vendors) from Odoo with pagination. Returns contact names, emails, phone numbers, and company info.
- Lua path
app.integrations.odoo.list_contacts- Full name
odoo.odoo_list_contacts
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1). |
limit | integer | no | Number of contacts per page (default: 20, max: 100). |
name | string | no | Filter contacts by name (partial match). |
email | string | no | Filter contacts by email (partial match). |
is_company | boolean | no | Filter to only companies (true) or individuals (false). |
get_contact Read
Get full details of a specific Odoo contact by ID. Returns name, email, phone, address, and all associated data.
- Lua path
app.integrations.odoo.get_contact- Full name
odoo.odoo_get_contact
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The Odoo contact ID. |
create_contact Write
Create a new contact (customer or vendor) in Odoo. Supports individuals and companies.
- Lua path
app.integrations.odoo.create_contact- Full name
odoo.odoo_create_contact
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Full name of the contact. |
email | string | no | Email address. |
phone | string | no | Phone number. |
is_company | boolean | no | Whether this is a company record (default: false). |
company_type | string | no | "company" or "person" (default: "person"). |
street | string | no | Street address. |
city | string | no | City. |
zip | string | no | Postal / ZIP code. |
country | string | no | Country name or code. |
website | string | no | Website URL. |
vat | string | no | Tax ID / VAT number. |
type | string | no | Contact type: "contact", "invoice", "delivery", or "other" (default: "contact"). |
parent_id | integer | no | Parent company ID for subsidiary contacts. |
function | string | no | Job position / title. |
list_sales_orders Read
List sales orders from Odoo with pagination. Filter by status, customer, or date range.
- Lua path
app.integrations.odoo.list_sales_orders- Full name
odoo.odoo_list_sales_orders
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1). |
limit | integer | no | Number of orders per page (default: 20, max: 100). |
status | string | no | Filter by status: "draft", "sent", "sale", "done", or "cancel". |
partner_id | integer | no | Filter by customer (partner) ID. |
date_from | string | no | Filter orders from this date (ISO 8601, e.g., "2025-01-01"). |
date_to | string | no | Filter orders up to this date (ISO 8601, e.g., "2025-12-31"). |
list_invoices Read
List invoices from Odoo with pagination. Filter by status, customer, or date range.
- Lua path
app.integrations.odoo.list_invoices- Full name
odoo.odoo_list_invoices
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1). |
limit | integer | no | Number of invoices per page (default: 20, max: 100). |
status | string | no | Filter by status: "draft", "posted", or "cancel". |
partner_id | integer | no | Filter by customer (partner) ID. |
date_from | string | no | Filter invoices from this date (ISO 8601, e.g., "2025-01-01"). |
date_to | string | no | Filter invoices up to this date (ISO 8601, e.g., "2025-12-31"). |
list_products Read
List products from Odoo with pagination. Filter by name, category, or type.
- Lua path
app.integrations.odoo.list_products- Full name
odoo.odoo_list_products
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1). |
limit | integer | no | Number of products per page (default: 20, max: 100). |
name | string | no | Filter products by name (partial match). |
category | string | no | Filter by product category name. |
type | string | no | Filter by type: "consumable", "service", or "product". |
sale_ok | boolean | no | Filter to products that can be sold (true) or not (false). |
purchase_ok | boolean | no | Filter to products that can be purchased (true) or not (false). |
list_leads Read
List CRM leads and opportunities from Odoo with pagination. Filter by stage, type, or assigned user.
- Lua path
app.integrations.odoo.list_leads- Full name
odoo.odoo_list_leads
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1). |
limit | integer | no | Number of leads per page (default: 20, max: 100). |
type | string | no | Filter by type: "lead" or "opportunity". |
stage | string | no | Filter by stage name (e.g., "New", "Qualified", "Won", "Lost"). |
user_id | integer | no | Filter by assigned salesperson (user ID). |
partner_id | integer | no | Filter by customer (partner) ID. |
get_current_user Read
Get the currently authenticated Odoo user profile. Returns name, email, role, and company information.
- Lua path
app.integrations.odoo.get_current_user- Full name
odoo.odoo_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||