Connect Odoo
In Peliqan, go to Connections > Add Connection > Select Odoo in the list > Enter the details of your Odoo instance.Authentication
You can choose to authenticate with your username and password or with your username and an API key. If 2FA (2-factor authentication) is enabled on your Odoo instance, you have to use an API key. To create an API key in Odoo go to > My profile > Account Security > API keys.Database name
If you don’t know your database name, you can make an unauthenticated API call, e.g. in Postman, to list your database names:Sync additional standard and/or custom models
You can include additional modules in the ETL pipeline, by adding a comma-separated list with the names of your standard and/or custom models, in the field “Additional models”. These models will now also be synced to the data warehouse as tables.Odoo model explorer
You can also run a script to get a list of models, and all fields of a selected model.Click to expand the script
Click to expand the script
Sync custom fields
Custom fields will automatically be added as columns in the tables in the data warehouse. If you add new custom fields in Odoo, perform a “Full resync” to include them in the data warehouse.Sync Charts of accounts in a specific language
Use the below custom pipeline script to sync the charts of accounts with a specific language (e.g. French or Dutch).Click to expand script
Click to expand script
Custom pipelines for Odoo
Peliqan will sync all fields of the selected models, except for calculated fields:- field property
store=True: field is included in Peliqan - field property
store=False: field is not included in Peliqan (calculated field)
Click here to see an example custom pipeline for Odoo
Click here to see an example custom pipeline for Odoo
Odoo data model
Use the below data app to explore models and fields in your Odoo instance.Odoo data model explorer
Odoo data model explorer
Click to expand script
Click to expand script
Check completeness of data in DWH
The below script will compare the number of records (count) in the data warehouse with the actual count in Odoo.Click here to expand script
Click here to expand script
Resync an Odoo table
Resync an Odoo table, e.g. when fields were added in Odoo (schema is updated), using the below script.Click to expand script
Click to expand script
Remove deleted records from the data warehouse
If records are deleted in Odoo, they are not automatically deleted in the data warehouse. Use below custom pipeline to delete records in the data warehouse, when they are no longer present in Odoo.Click to expand script
Click to expand script
Writeback to Odoo from Python scripts
Basic writeback functions
Example to add a Product to Odoo:Generic functions
These functions can be used to work with any model in Odoo, a standard or custom model. Add object from a given model:Applying multiple filters in Odoo
One can use generic get_object endpoint which can help applying multiple filters in on API request with dynamically defining the Model name. This will return the first page only, max. 50 results Please find below the example of working with multiple filters:Custom fields
Set value of a custom field:Fields of type One2Many
Examples of working with fields (basic or custom) of type one2many:Fields of type Many2Many and One2Many
Examples of working with fields (basic or custom) of type many2many or one2many:[[ 0, 0, { values } ]]link to a new record that needs to be created with the given values dictionary[[ 1, ID, { values } ]]update the linked record with id = ID (write values on it)[[ 2, ID ]]remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)[[ 3, ID ]]cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)[[ 4, ID ]]link to existing record with id = ID (adds a relationship)[[ 5 ]]unlink all[[ 6, 0, [IDs] ]]replace the list of linked IDs
Writing to Odoo in batch
Example to insert new records in Odoo in batch, to speed up large data migrations or data syncs:Working with product template & attributes
Example to link attribute values (e.g. Small, Medium, Large) for an attribute (e.g. “Size”) to a product template (e.g. “Shoe”):Click here to see the code of an end-to-end script including creation of product template, attributes, linking attributes to the template, updating the attributes and the automatically created product variants.
Click here to see the code of an end-to-end script including creation of product template, attributes, linking attributes to the template, updating the attributes and the automatically created product variants.
