Odoo API Flow

image::odoo-api-flow.png

Introduction

This flow is part of our Output flows collection. Output flows are used for exporting data from Node-RED environment to other services running inside Sandbox product.

Odoo API Flow can be used in various scenarios, where data has to be exported from Node-RED to module inside Odoo Service running on Sandbox.

Prerequisites

This flow along with its dependencies is available for user in the following package:

@senlab/node-red-odoo-api

To learn more about Verdaccio and how to install packages, please refer to this documentation: Verdaccio

To use this flow custom module needs to be up and running inside Odoo service. To find out how to create custom module inside Odoo service, please refer to this documentation: Odoo

MQTT Broker Service needs to be running on Sandbox for communication. To find out how to install services on Sandbox, please refer to this documentation: Services

Receive incomming data from MQTT Node

MQTT is our protocol of choice inside our Node-RED examples and you will see it being used many times. To find out what MQTT is and how to use it in the scope, please refer to this documentation: MQTT

MQTT Node has to be set up to listen to specified topic, URL field needs to be configured to the selected broker (Mosquitto or emqx). Since all Services are running inside containarized environment url can be configured using name of the service (eg. mqtt://emqx).

Setting up Odoo-xmlrpc-create Node

Odoo-xmlrpc-create Node is part of a node-red-contrib-odoo-xmlrpc-2021 package, which should already be installed as part of the @senlab/node-red-odoo-api package.

This node is expecting message body inside msg.payload property in form of JS object, which is already the case in this example.

Simple configuration needs to be done before deploying the flow. In configuration window pencil icon next to the URL window should be pressed to enter user configuration, from there URL of Odoo service should be entered along with database name, username and password, all of these credentials were part of user signup when configuring Odoo Service. Back in the first configuration window Model/Module name needs to entered. Module name is user defined when creating model, documentation about creating custom module inside Odoo was referenced at the beggining of this Docs file.

odoo config