ODBC Driver for Odoo

Build 24.0.9060

Data Model

The driver represents Odoo models as relational tables and views. The table definitions are dynamically obtained from the Odoo site you connect to, and the exact ones that will be availble to you will be different depending upon the apps you have installed. The tables listed here are only examples, which may differ from the ones available to you.

Tables

When connecting, the driver determines what models you can modify and which are read-only. Models that can be modified are represented as tables, which have support for reading, inserting, updating and deleting data.

Views

Any models that are read-only are represented as views. You can read data from them the same as you would a table, but inserting, updating and deleting are not allowed.

Many2One, One2Many and Many2Many Columns

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:

Many2One

Many2One columns are references to a single row within another model. Within the driver, Many2One columns are represented as integers, whose value is the id that they refer to in the other model.

For example, the Calendar module inludes a model for events called "calendar_event", which has a column called "opportunity_id" that refers to an opportunity in the "crm_lead" model. When creating or updating a calendar event, you can set the opportunity_id to the id of the lead the meeting is for:

INSERT INTO calendar_event (name, start, stop, opportunity_id) VALUES ('Meet With Potential Customer', '...', '...', 42)

If you were to read this event later, the value of opportunity_id would be the number 42.

Many2Many

Many2Many columns are references to many rows within another model. Within the driver, Many2Many 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.

For example, the Calendar module inludes a model for events called "calendar_event", which has a column called "partner_ids" that refers to contacts in the "res_partner" model. When creating or updating a calendar event, you can set the partner_ids to the ids of the people who are attending the meeting:

INSERT INTO calendar_event (name, start, stop, partner_ids) VALUES ('Meet With Potential Customer', '...', '...', '13,57')

If you were to read this event later, the value of partner_ids would be the text "13,57" (or "57,13", since the ids can be in any order).

One2Many

One2Many columns are references to many rows within another model - they are similar to Many2Many columns, except that each row in the referenced model must belong to only one in the main model.

For example, the Calendar module inludes a model for events called "calendar_event", which has a column called "attendee_ids" that refers to the meeting invitations stored in the "event_attendee" model. Unlike partner_ids, where different meetings can share the same partners and different partners can go to the same meeting, each invitation is linked to just one event.

Currently, these columns are read the same was as Many2Many columns (as text containing a comma-separated list of ids), but they cannot be written to.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060