Octov0.11.17
ReferenceConnectors

Odoo

Read and change records in any Odoo app, on Odoo 19 or Odoo 18 and earlier.

The odoo connector holds an Odoo API key and calls an Odoo server; its blocks search, read, create, update and delete records, and call any other method a model offers. Every Odoo app — Contacts, CRM, Sales, Invoicing, Inventory, a custom module — is a set of models that all take the same calls, so these blocks reach every installed app without app-specific configuration.

odoo connector

The connector provides no source. Every odoo-* block binds to it by name.

Settings

SettingTypeRequiredDefaultDescription
version19 | 18No19Odoo server version, which selects the protocol. See Versions.
urlstringYesnoneBase URL of the Odoo server, e.g. https://mycompany.odoo.com.
apiKeystringYesnoneAPI key of the Odoo user the flow acts as.
databasestringVersion 18noneDatabase to use. Version 19 needs it only when the server hosts more than one database.
usernamestringVersion 18noneLogin of the user the API key belongs to.
timeoutdurationNo30sBounds each Odoo call.

Create the API key in Odoo under Preferences → Account Security → New API Key. Every call runs as that key's user, with that user's access rights and record rules, so create a dedicated user for an integration and give it only the apps it needs.

env:
  - name: ODOO_URL
    required: true
  - name: ODOO_API_KEY
    required: true

connectors:
  - name: odoo
    type: odoo
    settings:
      url: ${ODOO_URL}
      apiKey: ${ODOO_API_KEY}

The connector makes no request when it starts: a wrong key or URL surfaces on the first call, as a flow error.

On Odoo Online, the external API is not available on every subscription plan. Check that yours includes it before you build against it.

Versions

Odoo 19 introduced the JSON-2 API, and Odoo 18 and earlier serve only the older JSON-RPC endpoint. version picks which one the connector speaks; the blocks behave the same on both.

version: 19version: 18
EndpointPOST /json/2/<model>/<method>POST /jsonrpc (execute_kw)
AuthenticationAPI key as a bearer tokenDatabase, username and API key
ServersOdoo 19 and laterOdoo 14 to 18, and Odoo 19, which still accepts it
  - name: odoo
    type: odoo
    settings:
      version: 18
      url: ${ODOO_URL}
      apiKey: ${ODOO_API_KEY}
      database: ${ODOO_DATABASE}
      username: ${ODOO_USERNAME}

The version 18 connector looks up the user's id on its first call and reuses it. A failed lookup is not remembered, so a key you fix in Odoo takes effect without a restart.

Results and errors

Every block follows one rule for its result: it becomes the message body, unless you name a resultVar, in which case it goes there and the body is left alone.

Results are Odoo's own values, unchanged:

  • A many2one field reads as [id, "Display Name"], e.g. "stage_id": [1, "New"].
  • A one2many or many2many field reads as a list of ids.
  • An empty field reads as false, not null, whatever its type.

Wherever a block takes record ids, it accepts one id, a list of ids, or a many2one value, so vars.lead[0].partner_id can name the partner directly.

Every block has a failOnError setting (default true). When Odoo reports an error — access denied, a validation error, an unknown method — the flow fails with the Odoo exception name and message, e.g. odoo.exceptions.ValidationError: Contacts require a name. With failOnError: false the message passes through unchanged.

Context

Every block takes an optional context, a CEL expression producing Odoo's call context. Use it to choose the language of translated fields, the timezone, or the companies a multi-company user acts in:

context: '{"lang": "es_AR", "allowed_company_ids": [2]}'

odoo-search-read block

Find the records of a model that match a domain, and read their fields. The result is a list, [] when nothing matched.

SettingTypeRequiredDefaultDescription
connectorstringYesnoneName of the odoo connector to use.
modelCELYesnoneModel to search, e.g. "res.partner".
domainCELNomatch everythingOdoo domain, a list of [field, operator, value] conditions.
fieldslist of stringsNoevery fieldFields to read.
limitintNoallMost records to return.
offsetintNo0Records to skip before returning any.
orderstringNothe model's defaultSort specification, e.g. create_date desc, id.
contextCELNononeCall context.
resultVarstringNononeStore the result here instead of in the body.
failOnErrorboolNotrueTurn an Odoo error into a flow error.
  - type: odoo-search-read
    settings:
      connector: odoo
      model: '"res.partner"'
      domain: '[["email", "=ilike", body.email]]'
      fields: [id, name]
      limit: 1

Conditions in a domain are joined with AND. Put "|" before two conditions to OR them: '["|", ["email", "=", body.email], ["phone", "=", body.phone]]'. Set fields on every call: reading every field of a model like res.partner returns well over a hundred of them.

odoo-read block

Read records by id. The result is a list of records.

SettingTypeRequiredDefaultDescription
connectorstringYesnoneName of the odoo connector to use.
modelCELYesnoneModel to read.
idsCELYesnoneA record id, a list of them, or a many2one value.
fieldslist of stringsNoevery fieldFields to read.
contextCELNononeCall context.
resultVarstringNononeStore the result here instead of in the body.
failOnErrorboolNotrueTurn an Odoo error into a flow error.
  - type: odoo-read
    settings:
      connector: odoo
      model: '"crm.lead"'
      ids: int(vars.id)
      fields: [name, partner_id, stage_id, expected_revenue]

odoo-create block

Create one record from an object, or several from a list of them. The result is always a list of the new ids, so one record reads as vars.lead[0].

SettingTypeRequiredDefaultDescription
connectorstringYesnoneName of the odoo connector to use.
modelCELYesnoneModel to create records in.
valuesCELYesnoneField values, or a list of them.
contextCELNononeCall context.
resultVarstringNononeStore the new ids here instead of in the body.
failOnErrorboolNotrueTurn an Odoo error into a flow error.

Values use Odoo's write format: a many2one field takes an id, and a one2many or many2many field takes a list of commands. [0, 0, {...}] creates a linked record, [4, id] links an existing one, and [6, 0, [ids]] replaces the whole set.

  - type: odoo-create
    settings:
      connector: odoo
      model: '"sale.order"'
      values: |
        {"partner_id": vars.partnerId,
         "order_line": [[0, 0, {"product_id": body.productId,
                                "product_uom_qty": body.quantity}]]}
      resultVar: order

odoo-write block

Set the same values on records by id. The result is true.

SettingTypeRequiredDefaultDescription
connectorstringYesnoneName of the odoo connector to use.
modelCELYesnoneModel to update.
idsCELYesnoneA record id, a list of them, or a many2one value.
valuesCELYesnoneField values to set, in the same format as odoo-create.
contextCELNononeCall context.
resultVarstringNononeStore the result here instead of in the body.
failOnErrorboolNotrueTurn an Odoo error into a flow error.
  - type: odoo-write
    settings:
      connector: odoo
      model: '"crm.lead"'
      ids: body.leadId
      values: '{"priority": "2", "tag_ids": [[4, body.tagId]]}'

odoo-delete block

Delete records by id. The result is true. Odoo refuses to delete some records outright, such as a confirmed sales order or a posted invoice; cancel those with odoo-call instead.

SettingTypeRequiredDefaultDescription
connectorstringYesnoneName of the odoo connector to use.
modelCELYesnoneModel to delete from.
idsCELYesnoneA record id, a list of them, or a many2one value.
contextCELNononeCall context.
resultVarstringNononeStore the result here instead of in the body.
failOnErrorboolNotrueTurn an Odoo error into a flow error.

odoo-call block

Call any public method of a model: on the model itself, or on records when you set ids. The result is whatever the method returns. Use it for everything the other blocks do not cover: confirming an order, posting an invoice, writing to a record's chatter, or a method a custom module adds.

SettingTypeRequiredDefaultDescription
connectorstringYesnoneName of the odoo connector to use.
modelCELYesnoneModel to call.
methodCELYesnoneMethod to call, e.g. "action_confirm".
idsCELNononeRecords to call the method on. Without it the method runs on the model.
paramsCELNononeThe method's arguments by name, as an object.
contextCELNononeCall context.
resultVarstringNononeStore the result here instead of in the body.
failOnErrorboolNotrueTurn an Odoo error into a flow error.
  # Post an internal note on a lead's chatter.
  - type: odoo-call
    settings:
      connector: odoo
      model: '"crm.lead"'
      method: '"message_post"'
      ids: vars.lead
      params: '{"body": "Captured from the website form", "subtype_xmlid": "mail.mt_note"}'

Arguments are always passed by name. On version: 18, a custom method that reads its first argument positionally (as Odoo's own batch create does) does not receive it by name; the connector handles create itself, but a custom method of that kind needs a named-argument wrapper on the Odoo side.

Common models

The blocks take any model name. These are the models behind the most-used apps, and the calls that move their records along:

AppModelTypical calls
Contactsres.partnerFind a contact by email, create or update it.
CRMcrm.leadCreate a lead from a form; write its stage_id to move it along the pipeline.
Salessale.order, sale.order.lineCreate a quotation with lines; action_confirm turns it into an order.
Invoicingaccount.moveCreate a customer invoice (move_type: "out_invoice"); action_post posts it; read payment_state to see whether it is paid.
Inventoryproduct.product, stock.quant, stock.pickingRead products and on-hand quantities; validate a transfer with button_validate.
Purchasepurchase.orderCreate a request for quotation; button_confirm confirms it.
Projectproject.taskCreate and update tasks.
Helpdesk (Enterprise)helpdesk.ticketCreate tickets and move their stage.
Employeeshr.employeeRead the employee directory.
Any model with a chattermail.thread methodsmessage_post writes a message or note on the record.

To find a model's fields, call fields_get through odoo-call with params: '{"attributes": ["string", "type", "required"]}', or turn on developer mode in Odoo and hover over any field.

On this page