# Odoo

> Create, search, read, update, and delete records in any Odoo model (contacts, CRM leads, sales orders, products, and more) through Odoo's External API.

App · CRM Systems · 5 actions. Web page: https://docs.lodol.com/docs/integrations/odoo

## Actions

### Create a record

Create a record in any Odoo model (a contact, lead, sales order, product, task, and so on) and get back its new id.

**Inputs**

- Model (`model`, text, required): Odoo model technical name, for example 'res.partner' (contacts & customers), 'crm.lead' (leads & opportunities), 'sale.order' (quotations & sales orders), 'product.template' (products), or 'project.task' (tasks).
- Field values (`values`, object, required): The new record's field values as field-name to value pairs, for example name: 'Acme Inc.', email: 'contact@acme.com'. Use Odoo's technical field names; a many2one field (like a country) takes the related record's id.

**Outputs**

- `id` (number): Database id of the new record (use it as Record ID in Get, Update, or Delete).
- `model` (text): The model the record was created in.

**Example output**

```json
{
  "id": 42,
  "model": "res.partner"
}
```

### Delete a record

Delete a record from an Odoo model by its id.

**Inputs**

- Model (`model`, text, required): Odoo model technical name, for example 'res.partner' (contacts & customers), 'crm.lead' (leads & opportunities), 'sale.order' (quotations & sales orders), 'product.template' (products), or 'project.task' (tasks).
- Record ID (`record_id`, number, required): The database id of the record to delete. At least 1.

**Outputs**

- `id` (number): The id of the deleted record.
- `model` (text): The model the record belonged to.
- `success` (true/false): Whether Odoo deleted the record.

**Example output**

```json
{
  "id": 42,
  "model": "res.partner",
  "success": true
}
```

### Get a record

Read a single Odoo record by its id: handy right after creating one, or once you have an id from a Search step.

**Inputs**

- Model (`model`, text, required): Odoo model technical name, for example 'res.partner' (contacts & customers), 'crm.lead' (leads & opportunities), 'sale.order' (quotations & sales orders), 'product.template' (products), or 'project.task' (tasks).
- Record ID (`record_id`, number, required): The database id of the record to read (from a Create or Search step, or the record's URL in Odoo). At least 1.
- Fields (`fields`, list): Optional list of field names to return. Leave empty to return every readable field.

**Outputs**

- `record` (object): The record's field values, or an empty object if the id no longer exists.

**Example output**

```json
{
  "record": {
    "email": "contact@acme.com",
    "id": 42,
    "name": "Acme Inc."
  }
}
```

### Search & read records

Find records in an Odoo model that match a filter and read their fields in one call: the workhorse for listing contacts, open opportunities, recent orders, and the like.

**Inputs**

- Model (`model`, text, required): Odoo model technical name, for example 'res.partner' (contacts & customers), 'crm.lead' (leads & opportunities), 'sale.order' (quotations & sales orders), 'product.template' (products), or 'project.task' (tasks).
- Filter (domain) (`domain`, list): Optional Odoo domain: a list of [field, operator, value] conditions, for example [["is_company", "=", true]] or [["email", "=", "contact@acme.com"]]. Leave empty to match every record.
- Fields (`fields`, list): Optional list of field names to return, for example ['name', 'email', 'phone']. Leave empty to return every readable field.
- Limit (`limit`, number): Optional maximum number of records to return. At least 1.
- Offset (`offset`, number): Optional number of matching records to skip (for paging). At least 0.
- Sort order (`order`, text): Optional sort clause, for example 'create_date desc' or 'name asc'.

**Outputs**

- `count` (number): How many records this call returned.
- `records` (list): Matching records, each an object of the requested field values plus its 'id'.

**Example output**

```json
{
  "count": 1,
  "records": [
    {
      "email": "contact@acme.com",
      "id": 42,
      "name": "Acme Inc."
    }
  ]
}
```

### Update a record

Change field values on an existing Odoo record: update a contact's details, move an opportunity's stage, and so on.

**Inputs**

- Model (`model`, text, required): Odoo model technical name, for example 'res.partner' (contacts & customers), 'crm.lead' (leads & opportunities), 'sale.order' (quotations & sales orders), 'product.template' (products), or 'project.task' (tasks).
- Record ID (`record_id`, number, required): The database id of the record to update. At least 1.
- Field values (`values`, object, required): The fields to change and their new values, for example phone: '+1 555 0100'. Fields you leave out keep their current values.

**Outputs**

- `id` (number): The id of the updated record.
- `model` (text): The model the record belongs to.
- `success` (true/false): Whether Odoo applied the update.

**Example output**

```json
{
  "id": 42,
  "model": "res.partner",
  "success": true
}
```
