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.
Input | Notes | Example |
---|---|---|
Odoo Base URL string / Required baseUrl | Enter the URL you visit when you log in to Odoo | https://yourdomain.odoo.com |
Odoo Database Name string / Required db | Click the user icon on the top-right within Odoo and then select 'My Databases' | odoo_db |
Password or API Key password / Required password | ||
Server Port string port | Leave blank to use default HTTP (80) or HTTPS (443) | 443 |
Username string / Required username | john.doe@example.com |
Actions
Create Record
Create a new record of a given type | key: createRecord
Input | Default | Notes | Example |
---|---|---|---|
Connection connection / Required connection | |||
External ID string externalId | A unique identifier mapping this record to an ID in an external system | abc-123 | |
Model string / Required 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 code / Required parameters |
Example Payload for Create Record
{
"data": 25
}
Delete Record By ID
Delete a record by its numerical ID | key: deleteRecordById
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | ||
Record ID string / Required id | The ID of the record you want. Odoo uses numbers for record IDs. | 25 |
Model string / Required model | The type of record you would like to query for. Use the 'List Models' action for a list of available models. | res.partner |
Example Payload for Delete Record By ID
{
"data": true
}
Get Record by External ID
Get a record by its external ID | key: getRecordByExternalId
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | ||
External ID string / Required externalId | A unique identifier mapping this record to an ID in an external system | abc-123 |
Example Payload for Get Record by External ID
{
"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
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | ||
Record ID string / Required id | The ID of the record you want. Odoo uses numbers for record IDs. | 25 |
Model string / Required model | The type of record you would like to query for. Use the 'List Models' action for a list of available models. | res.partner |
Example Payload for Get Record By ID
{
"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
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | ||
Model string / Required model | The type of record you would like to query for. Use the 'List Models' action for a list of available models. | res.partner |
Example Payload for List Model Fields
{
"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
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | ||
Model Search string modelSearch | Search for models whose contain this search term | res.partner |
Name Search string nameSearch | Search for models whose names contain this search term | Partner |
Example Payload for List Models
{
"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
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | ||
Pagination Limit string limit | Fetch only this many records at a time. See https://www.odoo.com/documentation/15.0/developer/api/external_api.html#pagination | 10 |
Model string / Required 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 string offset | Fetch records offset by this value. See https://www.odoo.com/documentation/15.0/developer/api/external_api.html#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.
Example Payload for List Records
{
"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
Input | Default | Notes | Example |
---|---|---|---|
Connection connection / Required connection | |||
Method string / Required method | The action to execute in Odoo | check_access_rights | |
Model string / Required 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 code / Required parameters |
Set External ID
Add an external ID to a record that does not have one | key: setExternalId
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | ||
External ID string / Required externalId | A unique identifier mapping this record to an ID in an external system | abc-123 |
Record ID string / Required id | The ID of the record you want. Odoo uses numbers for record IDs. | 25 |
Model string / Required model | The type of record you would like to query for. Use the 'List Models' action for a list of available models. | res.partner |
Example Payload for Set External ID
{
"data": 21943
}
Update Record
Update an existing record of a given type | key: updateRecord
Input | Default | Notes | Example |
---|---|---|---|
Connection connection / Required connection | |||
Record ID string / Required id | The ID of the record you want. Odoo uses numbers for record IDs. | 25 | |
Model string / Required 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 code / Required parameters |
Example Payload for Update Record
{
"data": true
}