| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Discuss (mail)
• Inventory (stock) • Invoicing (account) • Sales (sale_management) |
| Lines of code | 2354 |
| Technical Name |
commerce_bridge_magento2 |
| License | OPL-1 |
| Versions | 16.0 17.0 18.0 19.0 |
Magento 2 Connector Pro
Official Documentation
Welcome to the most transparent, operations-grade integration ever built for Magento and Odoo. This comprehensive manual covers everything from configuring MSI stock rules and order total guardrails, to operating the self-healing queue engine and fulfilling automated shipments.
Documentation Index
- 1. The Core Philosophy
- 2. Technical Deep Dive
- 3. Configuration & Settings
- 4. Guided Setup Workflow
- 5. The Mapping Center
- 6. Operations & Queue Triage
Killing the "Black Box"
Standard integrations operate entirely in the shadows. When an order drops due to a rounding error or an API timeout, your operations team is left blind. We built this module with absolute operational transparency and active database protection.
The Pre-Flight Readiness Checker
Before you ever push or pull massive amounts of data, our built-in auditor scans your system. It actively prevents database corruption.
- ✔ Blocks sync if duplicate Odoo SKUs are detected.
- ✔ Warns if Default Odoo Warehouses are not selected.
- ✔ Checks if critical mappings (Taxes, Shipping) are ignored.
- ✔ Generates a precise 0-100 System Health Score.
Inventory Drift Reconciliation
Never guess if your stock is accurate. The Inventory Drift module explicitly calculates the exact difference between Odoo's real-time stock and Magento's MSI Source quantities.
- ✔ Warning State: Flags minor differences ( > 0.0001 ).
- ✔ Critical State: Flags major differences ( > 10 units ).
- ✔ Not Found: Alerts if a product exists in Odoo but not Magento.
- ✔ One-Click Fix: Instantly generate an export job to fix drifted SKUs.
How the Code Actually Works
We have programmed complex logic to handle Magento's most notoriously difficult architectural quirks. Here is exactly how our module handles your most critical operations under the hood.
Order Routing & Financial Math Guardrails
Magento calculates taxes differently than Odoo. When parsing order JSON, the connector executes strict validation against the `order_total_tolerance` setting.
- ➜ Variant Splitting: The module ignores Magento `parent_item_id` lines. It only imports the physical Simple Product variant to Odoo.
- ➜ Shipping & Discounts: Extracts `shipping_amount` and `discount_amount` and converts them into dedicated Sale Order lines.
- ➜ Adjustment Injection: If Odoo's total differs from Magento's, the `order_total_policy` automatically injects a financial Adjustment Service Line to balance the accounting, or strictly blocks the import.
Multi-Source Inventory (MSI) & Safety Stock
Natively queries and updates the `/V1/inventory/source-items` API, allowing you to map multiple Odoo warehouses to precise Magento physical locations.
- ➜ Source Code Mapping: Export stock targeting specific `stock_source_code` values instead of overwriting global catalogs.
- ➜ Quantity Logic: Choose exactly what Odoo field calculates stock (`qty_available` / On Hand, `virtual_available` / Forecasted, or Free to Use).
- ➜ Safety Stock Buffer: Define a subtraction rule. If you set Safety Stock to 5, and Odoo has 12 items, the connector strictly pushes 7 units to Magento to prevent overselling.
Self-Healing Queue Engine
Every action is packaged into a `commerce.bridge.queue.job`. If a network timeout occurs, operations do not freeze.
- ➜ Exponential Backoff: Calculates retry delays using `min(60, 2 ** max(0, retry_count - 1))`, preventing you from getting IP-banned by your own server.
- ➜ Collision Locks: Generates strict `external_key` hashes to guarantee duplicate background jobs don't pile up.
- ➜ Human Action Hints: Catches raw JSON errors (like `401 Unauthorized` or `No such entity`) and translates them into plain-English advice in the Odoo interface.
Automated Shipments & Tracking
Fulfillment is tightly integrated into Odoo's native Inventory app.
- ➜ Stock Picking Hooks: Validated Odoo Delivery Orders (`stock.picking`) unlock an Export Shipment action.
- ➜ Item_ID Matching: The module parses `order_items_json` to map shipped SKUs back to their exact Magento `item_id`, ensuring partial fulfillments work perfectly.
- ➜ Tracking Number Push: Automatically extracts the Odoo Carrier Name and Tracking Reference to trigger the frontend Magento shipping email.
Configuration & Settings
Navigate to CommerceBridge → Instances and create a new instance. Below are the critical settings you must configure before initiating a sync.
1. Connection Rules
- Base URL: Your store URL (e.g.,
https://shop.com). - Access Token: Generated via Magento Admin.
- Store Code: Leave as
allto connect to the entire instance. - Verify SSL: Keep checked for security.
2. Order Rules
- Import From Date: Crucial: Prevents importing 10 years of history.
- Order Action: Import as
Draftor auto-Confirm. - Total Policy: Select
Block,Warn, orAdjust. - Tolerance: Allowed difference (e.g.,
0.05).
3. Inventory Rules
- Stock API Mode: Select
Magento MSIorClassic. - Source Code: Input your MSI Source Code.
- Quantity Field: Select Odoo stock field.
- Safety Stock: Units to subtract before export.
Step-by-Step Guided Setup
The module uses a strictly enforced, logical progression to ensure data integrity. Do not skip steps. Execute these actions directly via the action buttons on the Instance dashboard.
Test Connection & Import Stores
Click Test Connection. If successful, click Import Stores. The module will pull your exact Magento Websites, Store Groups, and Store Views into Odoo so the connector understands your site architecture and multi-store context.
Run Readiness Check
Click Run Readiness. Open the generated list. The system will grade your setup. Fix any Blocking issues (like missing MSI codes or duplicate internal references in Odoo) before proceeding.
Import Products & Orders
Click Import Products. The system pulls categories first, then products, creating permanent binding records. If Auto-Create is checked, missing SKUs are built. Then, click Import Orders. These actions create Background Jobs.
Export Stock
Once products are bound and the catalog is synced, click Export Stock. This reads Odoo's real-time inventory levels, deducts Safety Stock, and pushes the exact count to Magento.
The Mapping Center
Avoid hardcoded development. Connect text-based Magento logic to exact Odoo database models via the UI.
How to Map (Example):
1. Create record for Payment Method.
2. Set Magento Value to exactly what it sends (e.g., checkmo).
3. Enter Odoo Model (account.journal) and Record ID.
4. Click Mark as Mapped.
Daily Operations & Triage
All sync actions generate commerce.bridge.queue.job records. Triage errors without calling a developer.
- ✔ Retry Waiting: Job timed out and will auto-retry via exponential backoff.
- ✘ Failed Jobs: Hard error. Open the job to read the
Help Message. Fix data, click Retry. - 🔍 Sync Logs: View exact JSON Request/Response data sent to Magento for rapid IT debugging.
Stop fighting your integration.
Deploy a transparent, strictly enforced, operations-grade connector built to scale your Magento 2 and Odoo architecture securely. Fully verified and native.
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module