KosmoKrator

erp

Odoo ERP Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Odoo ERP KosmoKrator integration.

8 functions 7 read 1 write API key auth

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.

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

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
limitintegernoResults per page (default: 20, max: 100)
namestringnoFilter by name (partial match)
emailstringnoFilter by email (partial match)
is_companybooleannotrue 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

NameTypeRequiredDescription
idintegeryesThe 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

NameTypeRequiredDescription
namestringyesFull name of the contact
emailstringnoEmail address
phonestringnoPhone number
is_companybooleannoWhether this is a company (default: false)
company_typestringno"company" or "person" (default: "person")
streetstringnoStreet address
citystringnoCity
zipstringnoPostal / ZIP code
countrystringnoCountry name or code
websitestringnoWebsite URL
vatstringnoTax ID / VAT number
typestringnoContact type: "contact", "invoice", "delivery", "other"
parent_idintegernoParent company ID
functionstringnoJob position / title

Example

local result = app.integrations.odoo.create_contact({
  name = "Acme Corp",
  email = "[email protected]",
  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

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
limitintegernoResults per page (default: 20, max: 100)
statusstringnoFilter by status: "draft", "sent", "sale", "done", "cancel"
partner_idintegernoFilter by customer (partner) ID
date_fromstringnoFrom date (ISO 8601, e.g., "2025-01-01")
date_tostringnoTo 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

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
limitintegernoResults per page (default: 20, max: 100)
statusstringnoFilter by status: "draft", "posted", "cancel"
partner_idintegernoFilter by customer (partner) ID
date_fromstringnoFrom date (ISO 8601)
date_tostringnoTo 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

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
limitintegernoResults per page (default: 20, max: 100)
namestringnoFilter by name (partial match)
categorystringnoFilter by product category
typestringnoFilter by type: "consumable", "service", "product"
sale_okbooleannoCan be sold
purchase_okbooleannoCan 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

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
limitintegernoResults per page (default: 20, max: 100)
typestringnoFilter by type: "lead" or "opportunity"
stagestringnoFilter by stage: "New", "Qualified", "Won", "Lost"
user_idintegernoFilter by assigned salesperson
partner_idintegernoFilter 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 = "[email protected]",
  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.

Metadata-Derived Lua Example

local result = app.integrations.odoo.odoo_list_contacts({
  page = 1,
  limit = 1,
  name = "example_name",
  email = "example_email",
  is_company = true
})
print(result)

Functions

odoo_list_contacts

List contacts (customers, vendors) from Odoo with pagination. Returns contact names, emails, phone numbers, and company info.

Operation
Read read
Full name
odoo.odoo_list_contacts
ParameterTypeRequiredDescription
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).

odoo_get_contact

Get full details of a specific Odoo contact by ID. Returns name, email, phone, address, and all associated data.

Operation
Read read
Full name
odoo.odoo_get_contact
ParameterTypeRequiredDescription
id integer yes The Odoo contact ID.

odoo_create_contact

Create a new contact (customer or vendor) in Odoo. Supports individuals and companies.

Operation
Write write
Full name
odoo.odoo_create_contact
ParameterTypeRequiredDescription
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.

odoo_list_sales_orders

List sales orders from Odoo with pagination. Filter by status, customer, or date range.

Operation
Read read
Full name
odoo.odoo_list_sales_orders
ParameterTypeRequiredDescription
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").

odoo_list_invoices

List invoices from Odoo with pagination. Filter by status, customer, or date range.

Operation
Read read
Full name
odoo.odoo_list_invoices
ParameterTypeRequiredDescription
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").

odoo_list_products

List products from Odoo with pagination. Filter by name, category, or type.

Operation
Read read
Full name
odoo.odoo_list_products
ParameterTypeRequiredDescription
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).

odoo_list_leads

List CRM leads and opportunities from Odoo with pagination. Filter by stage, type, or assigned user.

Operation
Read read
Full name
odoo.odoo_list_leads
ParameterTypeRequiredDescription
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.

odoo_get_current_user

Get the currently authenticated Odoo user profile. Returns name, email, role, and company information.

Operation
Read read
Full name
odoo.odoo_get_current_user
ParameterTypeRequiredDescription
No parameters.