VOOZH about

URL: https://www.cdata.com/kb/tech/odoo-cloud-unqork.rst

⇱ Creating Odoo-Connected Applications in Unqork


Creating Odoo-Connected Applications in Unqork

πŸ‘ Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
You can use CData Connect AI to feed Odoo data to Unqork and build custom business apps.

Unqork is a completely visual, no-code application development platform that helps large organizations build complex custom software. CData Connect AI exposes Odoo as a REST endpoint, which you can then query from Unqork with simple HTTP requests. This enables you to create your own custom application with Odoo data.

You can use CData Connect AI to feed Odoo data to Unqork. From there you can build custom business applications in a visual, drag-and-drop interface. This article shows how to connect to Odoo and build workflows with live Odoo data in Unqork.

About Odoo Data Integration

Accessing and integrating live data from Odoo has never been easier with CData. Customers rely on CData connectivity to:

  • Access live data from both Odoo API 8.0+ and Odoo.sh Cloud ERP.
  • Extend the native Odoo features with intelligent handling of many-to-one, one-to-many, and many-to-many data properties. CData's connectivity solutions also intelligently handle complex data properties within Odoo. In addition to columns with simple values like text and dates, there are also columns that contain multiple values on each row. The driver decodes these kinds of values differently, depending upon the type of column the value comes from:
    • Many-to-one columns are references to a single row within another model. Within CData solutions, many-to-one columns are represented as integers, whose value is the ID to which they refer in the other model.
    • Many-to-many columns are references to many rows within another model. Within CData solutions, many-to-many columns are represented as text containing a comma-separated list of integers. Each value in that list is the ID of a row that is being referenced.
    • One-to-many columns are references to many rows within another model - they are similar to many-to-many columns (comma-separated lists of integers), except that each row in the referenced model must belong to only one in the main model.
  • Use SQL stored procedures to call server-side RFCs within Odoo.

Users frequently integrate Odoo with analytics tools such as Power BI and Qlik Sense, and leverage our tools to replicate Odoo data to databases or data warehouses.


Getting Started


Connect to Odoo from Unqork

To work with live Odoo data in Unqork, we need to connect to Odoo from Connect AI, provide user access to the connection, and create a Workspace for the Odoo data.

Connect to Odoo from Connect AI

CData Connect AI uses a straightforward, point-and-click interface to connect to data sources.

  1. Log into Connect AI, click Sources, and then click Add Connection
  2. πŸ‘ Adding a Connection
  3. Select "Odoo" from the Add Connection panel
  4. πŸ‘ Selecting a data source
  5. Enter the necessary authentication properties to connect to Odoo.

    To connect, set the Url to a valid Odoo site, User and Password to the connection details of the user you are connecting with, and Database to the Odoo database.

    πŸ‘ Configuring a connection (Salesforce is shown)
  6. Click Save & Test
  7. Navigate to the Permissions tab in the Add Odoo Connection page and update the User-based permissions. πŸ‘ Updating permissions

Add a Personal Access Token

When connecting to Connect AI through the REST API, the OData API, or the Virtual SQL Server, a Personal Access Token (PAT) is used to authenticate the connection to Connect AI. It is best practice to create a separate PAT for each service to maintain granularity of access.

  1. Click on the Gear icon () at the top right of the Connect AI app to open the settings page.
  2. On the Settings page, go to the Access Tokens section and click Create PAT.
  3. Give the PAT a name and click Create. πŸ‘ Creating a new PAT
  4. The personal access token is only visible at creation, so be sure to copy it and store it securely for future use.

Configure Odoo Endpoints for Unqork

After connecting to Odoo, create a workspace for your desired table(s).

  1. Navigate to the Workspaces page and click Add to create a new Workspace (or select an existing workspace). πŸ‘ The Workspaces page.
    πŸ‘ Adding a new Workspace.
  2. Click Add to add new assets to the Workspace.
  3. Select the Odoo connection (e.g. Odoo1) and click Next. πŸ‘ Selecting an Asset (Salesforce is shown).
  4. Select the table(s) you wish to work with and click Confirm. πŸ‘ Selecting Tables (Salesforce is shown).
  5. Make note of the OData Service URL for your workspace, e.g. https://cloud.cdata.com/api/odata/{workspace_name}

With the connection, PAT, and Workspace configured, you are ready to connect to Odoo data from Unqork.

Create a Simple Application for Odoo Data

With the OData Endpoint configured for Odoo through Connect AI, you are ready to create a Odoo-connected application in Unqork. Here are the basic steps to this process:

  • Register Odoo (via Connect AI) as an Unqork service
  • Create a workspace in Unqork
  • Create a module-type application

Register Odoo (via Connect AI) as an Unqork Service

To connect to Connect AI, you need to give your environment permission to connect with an external service. Do this through Services Administration.

  1. Click the Settings drop-down at the top right corner of the Unqork Designer Platform.
  2. Click Administration.
  3. Under Integrations, click Services Administration.
  4. Enter a Service Title, for example, Connect AI.
  5. Enter a Service Name, for example, cdataConnect.
  6. Enter a Service protocol + host. This is the API endpoint you want to reference. For example, https://cloud.cdata.com/api/odata/{workspace_name}.
  7. Select Basic Auth from the Type of Authentications drop-down.
  8. Enter the Connect AI user ID (e.g. [email protected]) in the User Name field.
  9. Enter the Connect AI user PAT in the Password field. πŸ‘ Adding a Service for Connect AI
  10. Click Add Service.

Create a Workspace

Unqork lets you create your own workspace, which is a virtual container for you and your team to store and organize your applications. Once you build a workspace, you can add applications to it.

To create a workspace:

  1. Click Create Workspace
  2. Enter a unique Workspace Name
  3. Click Create

Your workspace tile appears under the Workspaces tab.

Create a Module-Type Application

With your workspace added, you are ready to create your application. You have the choice between a module-type and workflow-type application. For this use case, make a module-type application.

  1. Navigate to the Apps tab from your open workspace.
  2. Click Create App.
  3. Enter a unique App Name.
  4. Select a preview style from the Style drop-down. A style specifies your application's appearance to your and-users. If left blank, your application uses the environment's default style.
  5. Select Module from the App Type drop-down.
  6. Select New Entrypoint Module from the App Entrypoint Module drop-down.
  7. Click Create.

You will land on the Modules tab of your new application. It should look like the following:

πŸ‘ The Modules tab of the new application.

Click the title to name the module in the Module Editor.

To complete your application, you need the following components:

  • Hidden component: stores the data retrieved by the Plug-In
  • Initializer component: executes the Plug-In when displaying tables
  • Plug-In component: retrieves Odoo data through Connect AI and stores it in the Hidden component
  • ViewGrid component: creates on HTML table from the data stored in the Hidden component

Configure the Hidden Component

This Hidden component stores the Odoo data retrieved through Connect AI.

  1. Drag and drop a Hidden component onto your canvas.
  2. Enter a Property ID and Canvas Label Text.
  3. NOTE: Property IDs must be in Camel Case (stylized as camelCase). For example, hiddenComponent. Since the Hidden component is not visible to and-users, use your Property ID as the Canvas Label Text.

  4. Click Save.

Configure the Plug-in Component

Next, add a Plug-In component to request data from Connect AI. This component connects with the service you set up in Services Administration.

  1. Drag and drop a Plug-In component onto your canvas, placing it below the Hidden component.
  2. Enter a Property ID and Canvas Label Text.

    NOTE: You must use Camel Case (stylized as camelCase). For naming best practices, start your Plug-In's Property ID with plugin. For example, pluginGetAWProducts.

  3. Configure the Outputs table as follows:
    • Enter the Property ID of your Hidden component in the Property ID column.
    • Enter value in the Mapping column.
  4. Select External as the Service Type
  5. From the External Services drop-down, select your Connect AI service. This is the external service you set up in Services Administration.
  6. Add the specific endpoint for your Connect AI resources to the and of the Data Sources URL. For example, AdventureWorks2012_Production_Product. πŸ‘ Highlighting a specific endpoint in Connect AI
  7. NOTE: Your Data Sources URL will have a value similar to: https://cloud.cdata.com/api/odata/{workspace_name}/AdventureWorks2012_Production_Product.

  8. Click Save.

Configure the Initializer Component

The Initializer component is what fires the Plug-In to retrieve your Odoo data.

  1. Drag and drop on Initializer component onto your canvas, placing it above the Plug-In component.
  2. Enter a Property ID and Canvas Label Text.

    NOTE: You must use Camel Case (stylized as camelCase). For naming best practices, start your Initializer's Property Name with init. For example, initGetAWProducts.

  3. Set New Submission as the Trigger Type.
  4. In the Outputs table, enter the following:
    • Enter the Property ID of your Plug-In in the Property ID column's field.
    • Enter trigger in the Type column's field.
    • Enter GO in the Value column's field.
  5. Click Save.

Configure the ViewGrid Component

The ViewGrid component references the data stored in your Hidden component. Then, it displays the Odoo data to your and-users in a dashboard (or table).

  1. Drag and drop a ViewGrid component onto your canvas, placing it below the Plug-In component.
  2. Enter a Label and Property Name.

    NOTE: You must use Camel Case (stylized as camelCase). For naming best practices, start your ViewGrid's Property Name with vg. For example, vgAWProductView.

  3. In the Inputs table, set id to the Property ID of the hidden component.
  4. In the Display table:
    • In the id column: enter the IDs of the fields you want to display.
    • In the handing column: enter the title you want for each field. This is how the field will display to your and-users.
    πŸ‘ Configuring the ViewGrid Inputs and Display
  5. Click Save.
  6. Save your module.

Once you add and configure the above components, you can preview how your application looks to and-users. In the Module Editor, click Preview Module to see the front-facing view (or "Express View") of the module.

Your Express View module should look something like this:

πŸ‘ Previewing the Module

More Information & Free Trial

With Connect AI and Unqork, you can easily build Odoo-connected applications. Request a free trial of Connect AI and start working with Odoo data in Unqork today.

Ready to get started?

Learn more about CData Connect AI or sign up for free trial access:

Free Trial