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.

Odoo 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
Input
Odoo Base URL
string
/ Required
Notes
Enter the URL you visit when you log in to Odoo
Example
https://yourdomain.odoo.com
Input
Odoo Database Name
string
/ Required
Notes
Click the user icon on the top-right within Odoo and then select 'My Databases'
Example
odoo_db
Input
Password or API Key
password
/ Required
Notes
 
Example
 
Input
Server Port
string
Notes
Leave blank to use default HTTP (80) or HTTPS (443)
Example
443
Input
Username
string
/ Required
Notes
 
Example
john.doe@example.com

Actions#

Create Record#

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

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
External ID
string
Default
Notes
A unique identifier mapping this record to an ID in an external system
Example
abc-123
Input
Model
string
/ Required
Default
Notes
The type of record you would like to query for. Use the 'List Models' action for a list of available models.
Example
res.partner
Input
Parameters
code
/ Required
Default
{  "name": "John Doe",  "email": "doe@example.com",  "country_code": "US",  "city": "New York",  "zip": "10001"}
Notes
 
Example
 

Output Example Payload#

{  "data": 25}

Delete Record By ID#

Delete a record by its numerical ID | key: deleteRecordById

InputNotesExample
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Record ID
string
/ Required
Notes
The ID of the record you want. Odoo uses numbers for record IDs.
Example
25
Input
Model
string
/ Required
Notes
The type of record you would like to query for. Use the 'List Models' action for a list of available models.
Example
res.partner

Output Example Payload#

{  "data": true}

Get Record by External ID#

Get a record by its external ID | key: getRecordByExternalId

InputNotesExample
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
External ID
string
/ Required
Notes
A unique identifier mapping this record to an ID in an external system
Example
abc-123

Output Example Payload#

{  "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
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Record ID
string
/ Required
Notes
The ID of the record you want. Odoo uses numbers for record IDs.
Example
25
Input
Model
string
/ Required
Notes
The type of record you would like to query for. Use the 'List Models' action for a list of available models.
Example
res.partner

Output Example Payload#

{  "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
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Model
string
/ Required
Notes
The type of record you would like to query for. Use the 'List Models' action for a list of available models.
Example
res.partner

Output Example Payload#

{  "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
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Model Search
string
Notes
Search for models whose contain this search term
Example
res.partner
Input
Name Search
string
Notes
Search for models whose names contain this search term
Example
Partner

Output Example Payload#

{  "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
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Pagination Limit
string
Notes
Fetch only this many records at a time. See https://www.odoo.com/documentation/15.0/developer/api/external_api.html#pagination
Example
10
Input
Model
string
/ Required
Notes
The type of record you would like to query for. Use the 'List Models' action for a list of available models.
Example
res.partner
Input
Pagination Offset
string
Notes
Fetch records offset by this value. See https://www.odoo.com/documentation/15.0/developer/api/external_api.html#pagination
Example
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.

Output Example Payload#

{  "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

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
Method
string
/ Required
Default
Notes
The action to execute in Odoo
Example
check_access_rights
Input
Model
string
/ Required
Default
Notes
The type of record you would like to query for. Use the 'List Models' action for a list of available models.
Example
res.partner
Input
Parameters
code
/ Required
Default
[["read"]]
Notes
 
Example
 

Set External ID#

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

InputNotesExample
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
External ID
string
/ Required
Notes
A unique identifier mapping this record to an ID in an external system
Example
abc-123
Input
Record ID
string
/ Required
Notes
The ID of the record you want. Odoo uses numbers for record IDs.
Example
25
Input
Model
string
/ Required
Notes
The type of record you would like to query for. Use the 'List Models' action for a list of available models.
Example
res.partner

Output Example Payload#

{  "data": 21943}

Update Record#

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

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
Record ID
string
/ Required
Default
Notes
The ID of the record you want. Odoo uses numbers for record IDs.
Example
25
Input
Model
string
/ Required
Default
Notes
The type of record you would like to query for. Use the 'List Models' action for a list of available models.
Example
res.partner
Input
Parameters
code
/ Required
Default
{  "name": "John Doe",  "email": "doe@example.com",  "country_code": "US",  "city": "New York",  "zip": "10001"}
Notes
 
Example
 

Output Example Payload#

{  "data": true}