| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Community Apps Dependencies | Show |
| Lines of code | 8188 |
| Technical Name |
connector_base |
| License | AGPL-3 |
| Website | https://www.moonsun.au/apps/integeration-toolbox |
| Versions | 18.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Community Apps Dependencies | Show |
| Lines of code | 8188 |
| Technical Name |
connector_base |
| License | AGPL-3 |
| Website | https://www.moonsun.au/apps/integeration-toolbox |
| Versions | 18.0 |
Description
The module you’ve developed for Odoo 17 is an extension of the OCA/connector framework, designed to provide a clean and standardized foundation for integrating Odoo with external systems. Instead of repeatedly implementing boilerplate logic for every new connector, this module introduces a reusable architecture that simplifies integration development and makes connectors easier to maintain over time.
A key goal of this project is to bring Aspect-Oriented Programming (AOP) principles into Odoo’s connector development. By using a declarative API with decorators such as @importer and @collection, defining an importer for a third-party platform—like Shopify—becomes straightforward and expressive. Developers can focus on the behavior of the integration itself, while the module handles the underlying workflow, registration, and lifecycle of each connector component.
Long-term consistency is also a priority: the design ensures that the same connector structure can be adopted across multiple Odoo versions, enabling better code reusability and future compatibility. Additionally, the framework is built with testing in mind, ensuring that automated tests can be written easily and that integrations remain stable and reliable, even when interacting with external systems.
Overall, this project significantly reduces development complexity, improves maintainability, and provides a solid foundation for scalable and well-tested Odoo integrations with other platforms—all while minimizing the amount of code developers need to write.
Usecase
The primary purpose of this system is to synchronize data between two tables: one in Odoo, and one in an external system. It builds on the OCA Connector framework and introduces an AOP-style (Aspect-Oriented Programming) structure to minimize the amount of code required to create and manage connectors.
The module provides a clean and declarative API. For example, implementing an importer for Shopify products can be done as simply as:
@importer("shopify.import.product") @collection("shopify") class ShopifyProductImporter: """Implement an importer"""
Each connector follows the same architectural pattern across all supported Odoo versions, ensuring consistency and easier long-term maintenance. The system supports two core synchronization operations: importing data from the external system into Odoo, and exporting Odoo records to the external system.
When both sides provide timestamps for record updates, the module can automatically detect changes and perform continuous synchronization, ensuring both systems stay aligned without manual intervention.
Automated testing is also a key design objective, enabling developers to validate their connectors efficiently and maintain reliability as their integration evolves.
Installation
- Clone the project: First, clone the repository and place it inside your Odoo addons directory.
- Configure the addons path: Ensure that the connector module’s path is added to Odoo’s addons configuration so that Odoo can detect the module.
- Install the module: When developing or using a new connector, make sure this module is installed. Search for it in the Apps menu and install it just like any other Odoo module.
- Verify installation: Once installed, the Connector module will appear in your list of installed applications, enabling you to build and manage integrations with external systems.
Configuration
All global configuration options for the Connector system are available within the general Odoo settings.
To access them, navigate to Settings → Connector.
This section contains all the framework-level configuration parameters for the connector module.
In addition to the global settings, each external system connection also provides its own specific configuration options. To access and configure these:
Go to Connector → Configuration.
Within this section, you will find a list of available connector instances. Each connector can be configured independently, allowing you to tailor credentials, behavior, and synchronization rules for each external system.
This configuration guide applies to the Odoo 17 module designed for managing integrations between Odoo and external platforms.
Usage
The core principle behind this module is the adoption of Aspect-Oriented Programming (AOP) to simplify and standardize the implementation of Odoo connectors. By introducing decorators and a structured component model, integrations become easier to define, maintain, and scale. The developer only needs to focus on the logic specific to each external system, while the framework handles the common connector behavior.
Defining a Backend
Every connector begins with a backend model, which represents an instance of the connection to the external platform:
class KoganBackend(models.Model): _name = "connector.kogan.backend" _inherit = [ "connector.backend", "connector.backend.crud.mixin", "connector.backend.http.mixin", ] _description = "Backends for Kogan Connector"
This backend manages authentication, routing, and access to external APIs.
Defining an Import Mapper
Import mappers translate raw external data into Odoo fields. Using decorators, this can be defined in a clean and declarative style:
@import_mapper("kogan.import.mapper") @apply_on("product.product") @collection("connector.kogan.backend") class ProductImportMapper: direct = [ ("Title", "name"), ("sku", "default_code"), ]
The direct mapping ensures simple field transformation without custom code.
Implementing an Importer Component
Importers orchestrate the full import flow:
@importer("kogan.importer") @apply_on("product.product") @collection("connector.kogan.backend") class ProductImporter: @process(description="Import product from Kogan") def create(self, *args, **kwargs): return super().create(*args, **kwargs)
The decorator @process provides hooks for logging, retry logic, and error tracking.
Export Flow with Export Mapper and Exporter
Export logic is symmetrical:
@export_mapper("kogan.export.mapper") @apply_on("product.product") @collection("connector.kogan.backend") class ProductExportMapper: direct = [ ("name", "Title"), ("default_code", "sku"), ]
@exporter("kogan.exporter") @apply_on("product.product") @collection("connector.kogan.backend") class ProductExporter: @process(description="Export product to Kogan") def create(self, *args, **kwargs): return super().create(*args, **kwargs)
This enforces consistency and supports bi-directional synchronization.
Adapter for API Communication
The adapter is the final piece of the integration. It acts as the bridge to the live external API:
@adapter("kogan.adapter") @apply_on("product.product") class ProductAdapter: def get_records(self, *args, **kwargs): pass def get_record(self, *args, **kwargs): pass def create_record(self, *args, **kwargs): pass def update_record(self, *args, **kwargs): pass
Each method corresponds to an actual API action.
Result
With these five components defined:
- Backend
- Import Mapper
- Importer
- Export Mapper
- Exporter
- Adapter
The connector is fully operational and capable of importing and exporting product data. Most of the repetitive and common functionalities have already been implemented by the framework—leaving developers to implement only the API-specific parts.
This design allows:
- Minimal custom code
- Full automated testing support
- Standardized architecture across multiple Odoo versions
- Clean AOP-based extension points
- Fast development of new integrations
For deeper details, refer to the official technical documentation included in the project.
Contributer
Credits
History
17.0.0.1.0
This initial release introduced the core concept of a base module providing the fundamental tools required to implement connector functionality in Odoo.
17.0.1.0.0
In this release, error handling based on Aspect-Oriented Programming (AOP) principles was added to the system, ensuring better control and traceability during data synchronization processes.
17.0.1.1.0
This version introduced new capabilities for managing computational components through AOP. Additionally, features for defining the structural elements of a connector—such as adapters, mappers, and import/export logic—were implemented.
17.0.1.2.0
This release further enhanced the processing model by providing a full AOP-driven architecture for building and executing synchronization workflows.
Development
Create function
Each createion process should return list of generated records included both odoo record and binding.
Here is an example:
- result_list = [{
- "binding_id": binding.id, "binding_model_name": binding._name
}] return result_list
Please log in to comment on this module