Auto Sync Cron Jobs
The Magento 2 Connector includes built-in cron job support that automates data synchronization between Odoo and Magento at configurable intervals. This eliminates the need for manual sync operations and keeps your data continuously up to date.
Enabling Auto Sync
Auto sync is configured per instance:
- Navigate to Magento > Instances.
- Open your instance.
- Scroll down to the Auto Sync Cron section.
- Configure the following settings:
Schedule Settings
| Field | Description | Default |
|---|---|---|
| Auto Sync Enabled | Master toggle to enable or disable automatic synchronization | Disabled |
| Auto Sync Frequency | How often the sync runs (Hourly, Daily, Weekly) | Hourly |
| Hourly Interval | Specific interval between sync runs (e.g., Every 1 hour(s)) | Every 1 hour(s) |
Auto Sync Scope
Select which data types to include in each automatic sync run:
| Scope Option | Description |
|---|---|
| Products | Automatically sync products between Odoo and Magento |
| Customers | Automatically sync customer records |
| Categories | Automatically sync product categories |
| Orders | Automatically sync orders, invoices, and shipments |
You can enable or disable each scope independently. For example, you might want to sync orders every hour but only sync products once daily.
Built-in Cron Jobs
The connector registers the following cron jobs in Odoo's scheduler:
| Cron Job | Description | Source Action |
|---|---|---|
| Magento Product Sync | Pulls/pushes product data between systems | cron_auto_scope |
| Magento Customer Sync | Synchronizes customer records | cron_auto_scope |
| Magento Category Sync | Synchronizes product categories | cron_auto_scope |
| Magento Order Sync | Imports new and updated orders from Magento | cron_auto_scope |
| Magento Inventory Sync | Updates stock quantities across platforms | cron_auto_scope |
How Auto Sync Works
- Cron Trigger -- Odoo's scheduled action system triggers the sync job at the configured interval.
- Scope Check -- The connector checks which data types are enabled in the Auto Sync Scope.
- API Call -- For each enabled scope, the connector queries the Magento REST API for new or updated records.
- Data Processing -- New records are created in Odoo; existing records are updated with the latest data.
- Report Logging -- Each sync operation is logged in the Sync Reports with success/error counts, start time, and end time.
Monitoring Cron Jobs
You can monitor cron job execution in two ways:
Via Sync Reports
Navigate to Magento > Reports > Sync Reports to view detailed logs of every auto-sync run. Each entry shows:
- The sync type and mode (Cron)
- Source action (
cron_auto_scope) - Total records processed
- Success and error counts
- Start and end timestamps
Via Odoo Scheduled Actions
Navigate to Settings > Technical > Scheduled Actions to view and manage the underlying Odoo cron jobs. Here you can:
- View the next execution time
- Manually trigger a cron job
- Adjust the technical interval settings
If auto-sync appears to not be running, check the Odoo Scheduled Actions view to ensure the cron jobs are active and not stuck.
Best Practices
- Start with hourly sync -- Begin with hourly synchronization and adjust based on your volume and needs.
- Monitor error counts -- Regularly check Sync Reports for rising error counts that may indicate connectivity or data issues.
- Off-peak scheduling -- For large catalogs, consider running full product syncs during off-peak hours to minimize API load.
- Order sync priority -- Orders should generally sync more frequently than products or categories, as they are time-sensitive.
Running sync too frequently (e.g., every few minutes) may put excessive load on both Odoo and Magento servers. Hourly sync is recommended for most use cases.