Skip to main content

Odoo Component

Manage records in an Odoo database

Component key: odoo

Description

Odoo is a suite of open source business apps that include CRM, eCommerce, accounting, inventory, project management, etc. This component allows you to query and manage records in an Odoo database.

Developer Note: Odoo Models

An Odoo database tracks hundreds of types of records. A default installation of Odoo includes more than 800 unique record types (more if you install additional apps).

Each type of record is called a model, and models have human-readable names and model names. For example, contacts in Odoo are called Contacts, and their model name is res.partner. To list all contacts in an Odoo installation, use the List Records action and provide it a model of res.partner.

A model has fields. Contacts for example has hundreds of fields related to a person: name, email, country_code, zip, etc.

For your convenience, two utility actions are included in this component.

  • List Models will list all models in an Odoo installation, including their ID, name and model name.
  • List Model Fields will list all of the fields of a given model.

You can use these two utility actions to help you when you Create or Update records. Identify the name of the fields you would like to set for a given model. Then, create an object, either in a code step or another action and pass the results of that step in as a reference.

Connections

Odoo Connection

Customers can use Odoo's cloud service to access an Odoo database, or they can run Odoo on their own servers. Either way, Odoo uses basic auth to connect to an Odoo database.

  • For Base URL, you can enter the URL you visit when you log in to Odoo (something like https://example-company.odoo.com).
  • You can likely ignore Server Port, unless your customer uses a non-traditional port for accessing their Odoo installation.
  • The Database Name can be found by clicking the user icon on the top-right within Odoo, and then selecting My Databases.
  • Username is the email address the user uses to log in. We recommend they create a system account for integrations (i.e. not a specific user's account).
  • Password or API Key can either be the password your customer uses to log in to Odoo, or they can generate an API key. To generate an API key, your customer will need to go into settings, enable developer mode, and then from their user preferences they can generate an API key. See https://www.odoo.com/documentation/14.0/developer/api/external_api.html#api-keys.
InputNotesExample
Odoo Base URL

Enter the URL you visit when you log in to Odoo

https://yourdomain.odoo.com
Odoo Database Name

Click the user icon on the top-right within Odoo and then select 'My Databases'

odoo_db
Password or API Key
Server Port

Leave blank to use default HTTP (80) or HTTPS (443)

443
Usernamejohn.doe@example.com

Data Sources

Select Model

A picklist of Models in your Odoo database. | key: selectModel | type: picklist

InputNotesExample
Connection
Model Search

Search for models whose contain this search term.

res.partner
Name Search

Search for models whose names contain this search term.

Partner

{
"result": [
{
"key": "1",
"label": "Users (res.users)"
},
{
"key": "2",
"label": "Products (product.product)"
}
]
}

Select Record

A picklist of Records in your Odoo database. | key: selectRecordById | type: picklist

InputNotesExample
Connection
Model

The type of record you would like to query for. Use the 'List Models' action for a list of available models.

res.partner

{
"result": [
{
"key": "1",
"label": "General"
},
{
"key": "2",
"label": "Administrators"
}
]
}

Actions

Create Record

Create a new record of a given type | key: createRecord

InputNotesExample
Connection
External ID

A unique identifier mapping this record to an ID in an external system.

abc-123
Model

The type of record you would like to query for. Use the 'List Models' action for a list of available models.

res.partner
Parameters

A JSON object of field names and values to set on the record.

{
"data": 25
}

Delete Record By ID

Delete a record by its numerical ID | key: deleteRecordById

InputNotesExample
Connection
Record ID

The ID of the record you want. Odoo uses numbers for record IDs.

25
Model

The type of record you would like to query for. Use the 'List Models' action for a list of available models.

res.partner

{
"data": true
}

Get Record by External ID

Get a record by its external ID | key: getRecordByExternalId

InputNotesExample
Connection
External ID

A unique identifier mapping this record to an ID in an external system.

abc-123

{
"data": {
"id": 12,
"website_url": "/partners/john-doe-12",
"email": "bob@example.com",
"name": "John Doe",
"display_name": "John Doe",
"lang": "en_US"
}
}

Get Record By ID

Fetch a Record by its numerical ID | key: getRecordById

InputNotesExample
Connection
Record ID

The ID of the record you want. Odoo uses numbers for record IDs.

25
Model

The type of record you would like to query for. Use the 'List Models' action for a list of available models.

res.partner

{
"data": {
"id": 12,
"website_url": "/partners/john-doe-12",
"email": "bob@example.com",
"name": "John Doe",
"display_name": "John Doe",
"lang": "en_US"
}
}

List Model Fields

List all fields for a given model | key: listModelFields

InputNotesExample
Connection
Model

The type of record you would like to query for. Use the 'List Models' action for a list of available models.

res.partner

{
"data": {
"is_seo_optimized": {
"type": "boolean",
"change_default": false,
"company_dependent": false,
"depends": [],
"manual": false,
"readonly": true,
"required": false,
"searchable": false,
"sortable": false,
"store": false,
"string": "SEO optimized",
"name": "is_seo_optimized"
},
"website_meta_title": {
"type": "char",
"change_default": false,
"company_dependent": false,
"depends": [],
"manual": false,
"readonly": false,
"required": false,
"searchable": true,
"sortable": true,
"store": true,
"string": "Website meta title",
"translate": true,
"trim": true,
"name": "website_meta_title"
}
}
}

List Models

Fetch a list of models installed in the customer's Odoo database | key: listModels

InputNotesExample
Connection
Fetch All Records

Whether to fetch all records.

false
Pagination Limit

Fetch only this many records at a time. See Pagination.

10
Model Search

Search for models whose contain this search term.

res.partner
Name Search

Search for models whose names contain this search term.

Partner
Pagination Offset

Fetch records offset by this value. See Pagination.

20

{
"data": [
{
"id": 87,
"name": "Bank Accounts",
"model": "res.partner.bank",
"state": "base",
"modules": "account, base, l10n_us",
"display_name": "Bank Accounts"
},
{
"id": 85,
"name": "Industry",
"model": "res.partner.industry",
"state": "base",
"modules": "base",
"display_name": "Industry"
}
]
}

List Records

Fetch a list of records of a given type | key: listRecords

InputNotesExample
Connection
Fetch All Records

Whether to fetch all records.

false
Pagination Limit

Fetch only this many records at a time. See Pagination.

10
Model

The type of record you would like to query for. Use the 'List Models' action for a list of available models.

res.partner
Pagination Offset

Fetch records offset by this value. See Pagination.

20

If you expect Odoo will return lots of records, you can leverage pagination to process a small set of records at a time. See Odoo's docs on pagination.

{
"data": [
{
"id": 12,
"website_url": "/partners/john-doe-12",
"email": "bob@example.com",
"name": "John Doe",
"display_name": "John Doe",
"lang": "en_US"
}
]
}

Raw Request

Issue any execute_kw action | key: rawRequest

InputNotesExample
Connection
Method

The action to execute in Odoo.

check_access_rights
Model

The type of record you would like to query for. Use the 'List Models' action for a list of available models.

res.partner
Parameters

A JSON object of field names and values to set on the record.


Set External ID

Add an external ID to a record that does not have one | key: setExternalId

InputNotesExample
Connection
External ID

A unique identifier mapping this record to an ID in an external system.

abc-123
Record ID

The ID of the record you want. Odoo uses numbers for record IDs.

25
Model

The type of record you would like to query for. Use the 'List Models' action for a list of available models.

res.partner

{
"data": 21943
}

Update Record

Update an existing record of a given type | key: updateRecord

InputNotesExample
Connection
Record ID

The ID of the record you want. Odoo uses numbers for record IDs.

25
Model

The type of record you would like to query for. Use the 'List Models' action for a list of available models.

res.partner
Parameters

A JSON object of field names and values to set on the record.

{
"data": true
}