Odoo Data Flow¶
A powerful Python library for defining robust, repeatable, and high-performance data import/export workflows for Odoo. It replaces complex, manual data preparation with a clean, “configuration-as-code” approach.
Key Features¶
Declarative Transformations: Use simple Python scripts and a rich set of
mapperfunctions to transform any source CSV or XML data into an Odoo-ready format.Two-Phase Workflow: Cleanly separates data transformation from data loading, making complex migrations easier to manage, reuse, and debug.
High-Performance CLI: Import and export data with a clean, modern command-line interface, featuring high performance parallel processing (
--worker), batching (--size), and robust error handling.Automatic Scripting: Automatically generate shell scripts for the loading phase, ensuring a repeatable and reliable process every time.
Robust Error Handling and Recovery: Verify the number of records processed in a batch against the number successfully imported, helping to quickly identify issues.
Direct Server-to-Server Migration: Perform a complete export, transform, and import from one Odoo instance to another in a single, in-memory step with the
migratecommand.Post-Import Workflows: Run automated actions on your data after it has been imported (e.g., validating invoices, registering payments) using the powerful
workflowcommand.export data from Odoo into CSV format. While specific details on export parameters are not extensively documented in the provided text, this capability complements the import functionality, offering a complete solution for Odoo data management.
Multiple Data Sources: Natively supports CSV and XML files. Easily extendable to support other sources like databases or APIs.
Data Validation: Ensure data integrity before it even reaches Odoo.
Installation¶
You can install Odoo Data Flow via uv or pip from PyPI:
$ uv pip install odoo-data-flow
Quick Usage Example¶
The core workflow involves two simple steps:
1. Transform your source data with a Python script.
Create a transform.py file to define the mapping from your source file to Odoo’s format.
# transform.py
from odoo_data_flow.lib.transform import Processor
from odoo_data_flow.lib import mapper
my_mapping = {
'id': mapper.concat('prod_', 'SKU'),
'name': mapper.val('ProductName'),
'list_price': mapper.num('Price'),
}
processor = Processor('origin/products.csv')
processor.process(my_mapping, 'data/products_clean.csv', {'model': 'product.product'})
processor.write_to_file("load.sh")
…
$ python transform.py
2. Load the clean data into Odoo using the CLI.
The transform.py script generates a load.sh file containing the correct CLI command.
# Contents of the generated load.sh
odoo-data-flow import --config conf/connection.conf --file data/products_clean.csv --model product.product ...
Then execute the script.
$ bash load.sh
Documentation¶
For a complete user guide, tutorials, and API reference, please see the full documentation on Read the Docs. Please see the Command-line Reference for details.
Contributing¶
Contributions are very welcome. To learn more, see the Contributor Guide.
License¶
Distributed under the terms of the LGPL 3.0 license, Odoo Data Flow is free and open source software.
Issues¶
If you encounter any problems, please file an issue along with a detailed description.
Credits¶
This development of project is financially supported by stefcy.com. This project was generated from @bosd’s uv hypermodern python cookiecutter template.
Odoo Data Flow¶
A robust, declarative library for managing complex data imports and exports with Odoo.
Odoo Data Flow is a powerful and flexible Python library designed to simplify the import and export of data to and from Odoo. It allows you to define data mappings and transformations in a declarative way, making complex data operations manageable and repeatable. You can easily manage complex transformations, relationships, and validations, making your data integration tasks simpler and more reliable.
This library is the successor to the odoo-csv-import-export library, refactored for modern development practices and enhanced clarity.
Getting Started¶
Ready to simplify your Odoo data integrations?
Step |
Description |
|---|---|
Your first end-to-end example. Go from file to Odoo in minutes. |
|
⚙️ Installation |
How to install the library in your project. |
Understand the key ideas behind the library. |