| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
CRM (crm)
• Sales (sale_management) • Calendar (calendar) • Contacts (contacts) • Discuss (mail) • Invoicing (account) |
| Lines of code | 9451 |
| Technical Name |
oe_salesforce_connector |
| License | AGPL-3 |
| Website | https://www.oaklandmena.com |
| Versions | 16.0 17.0 18.0 19.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
CRM (crm)
• Sales (sale_management) • Calendar (calendar) • Contacts (contacts) • Discuss (mail) • Invoicing (account) |
| Lines of code | 9451 |
| Technical Name |
oe_salesforce_connector |
| License | AGPL-3 |
| Website | https://www.oaklandmena.com |
| Versions | 16.0 17.0 18.0 19.0 |
API Configuration
Import-Export Account
Import-Export Contact
Import-Export Event
Import-Export Opportunity
Import-Export Product
Import-Export Quotation
Module User Guide
This Odoo module provides an integration with Salesforce, enabling synchronization of key business data between your Odoo instance and Salesforce CRM. It streamlines data flow and ensures consistency across both platforms. 🔄
1. Module Overview
This module facilitates the synchronization of various business records, including customer information, products, sales orders, quotes, opportunities, leads, contracts, and activities, between Odoo and Salesforce. It streamlines data flow and ensures consistency across both platforms. 🔄
2. Configuration (Salesforce Instance Setup)
To set up the integration, you need to configure a Salesforce instance within Odoo:
- Access Configuration: Navigate to the Salesforce Integration settings in Odoo.
- Instance Details: Provide the following Salesforce API credentials:
- Name: A descriptive name for your Salesforce instance (e.g., "Production Org").
- Consumer Key: From your Salesforce Connected App.
- Consumer Secret: From your Salesforce Connected App.
- Authorization URL: Default:
https://login.salesforce.com/services/oauth2/authorize - Token URL: Default:
https://login.salesforce.com/services/oauth2/token - Redirect URL: Default:
http://localhost:8069/get_auth_code_from_sf - Instance URL: e.g.,
https://yourinstance.salesforce.com
- Authentication: Use the "Salesforce Login" button to authenticate Odoo with Salesforce.
- Connection Test: Click "Salesforce Test" to verify credentials.
- Synchronization Limits: Set Import/Export limits to manage performance.
- Default Instance: Mark one instance as default for Cron jobs. 🤖
3. Key Synchronized Data & Features
This module adds Salesforce-specific fields (e.g., x_salesforce_id, x_is_updated) to various models for tracking sync status.
Supported record types:
- Accounts/Contacts (
res.partner) 🤝 - Products (
product.template,product.product) 📦 - Sales Orders (
sale.order) 📝 - Quotations (inherited from
sale.order) 📧 - Opportunities & Leads (
crm.lead) 💰📞 - Contracts (
sf.contract) 📄 - Mail Activities (
mail.activity) ✅ - Calendar Events (
calendar.event) 🗓️ - Attachments (
ir.attachment) 📎
4. Synchronization Process
- Manual: Export records from form/list view with "Export to Salesforce" or "Sync Now" buttons. 🚀
- Cron Jobs: Auto-import/export via scheduled jobs (e.g.,
_scheduler_export_leads_to_sf). ⏰
5. Basic Troubleshooting
- Authentication Issues: Use "Salesforce Test" to diagnose problems. Ensure all credentials match your Salesforce Connected App. 🚫🔑
- Validation Errors: Only one instance per company should be default. Ensure all required fields are properly filled. Check Odoo logs for details. 🐛
Frequently Asked Questions
What is the purpose of this module?
What Salesforce API version does this integration use?
v52.0 (for Quote and Order related operations) and v39.0/v40.0 for other objects like Products and Events.
How do I configure the Salesforce instance in Odoo?
- Consumer Key (Client ID): Obtained from your Salesforce connected app.
- Consumer Secret (Client Secret): Obtained from your Salesforce connected app.
- Authorization URL: Default is
https://login.salesforce.com/services/oauth2/authorize. - Authorization Token URL: Default is
https://login.salesforce.com/services/oauth2/token. - Redirect URL: Default is
http://localhost:8069/get_salesforce_token(ensure this matches your Salesforce connected app's callback URL and is accessible).
You will also need to authorize the connection to obtain the access token.
What happens if there is no default Salesforce instance configured?
Which Odoo records can be synchronized with Salesforce?
- Accounts (
res.partnerwhereis_company=True) - Contacts (
res.partnerwhereis_company=False) - Products (
product.product) - Product Templates (
product.template) - Sale Quotations (
sale.orderin draft/sent state) - Sale Orders (
sale.order) - Leads (
crm.leadof type 'lead') - Opportunities (
crm.leadof type 'opportunity') - Contracts (
sf.contract) - Events (
calendar.event) - Activities (Tasks) (
mail.activity) - Attachments (
ir.attachment)
Is the synchronization bi-directional (Odoo to Salesforce and Salesforce to Odoo)?
Based on the code, the module supports:
- Export from Odoo to Salesforce: For Accounts, Contacts, Products, Product Templates, Sale Quotations, Sale Orders, Leads, Opportunities, Contracts, Events, and Activities.
- Import from Salesforce to Odoo: For Accounts, Contacts, Products, Product Templates, Quotes, Orders, Leads, Opportunities, Contracts, Events, and Activities (via scheduled cron jobs).
How is data synchronization initiated?
- Manual Export: Users can manually trigger the export of individual records (e.g., Partners, Products, Leads, Opportunities, Quotes, Orders, Contracts, Events, Activities) from their respective Odoo forms.
- Scheduled Cron Jobs: The module includes scheduled actions (cron jobs) to automatically import and export data for various objects at predefined intervals (e.g.,
_scheduler_import_sf_accounts,_scheduler_export_products_to_sf).
How does the module handle updates to records in Odoo?
Records in Odoo have an x_is_updated field. When certain fields are modified (e.g., x_last_modified_on for partners), this flag is set to True, indicating the record needs to be updated in Salesforce during the next export sync.
How are deleted records handled?
The unlink method for sale.order (Quotes/Sale Orders) and sale.order.line is extended to attempt deletion of corresponding records in Salesforce if they were previously exported (i.e., have a Salesforce ID). This helps maintain data consistency.
How are Products and Product Templates synchronized?
Product Templates and their variants can be exported to Salesforce as Product2 records. The integration also handles the creation and updating of PricebookEntry records in Salesforce for these products, linking them to a standard price book.
What happens when a Sale Order's contract changes?
If the contract_id on a Sale Order is changed, the module validates that the Odoo order date is not earlier than the contract's start date, raising a UserError if it is.
How are attachments synchronized?
The module includes logic to export attachments from Odoo to Salesforce. It uses ir.attachment records and tracks the Salesforce ContentDocumentId to prevent duplicate uploads.
How are addresses synchronized for Partners/Contacts?
When partners (companies or contacts) are exported, their main addresses are synchronized. Additionally, separate delivery addresses linked to contacts (child res.partner records with type='delivery') are also created or updated in Salesforce.
Can I export Leads and Opportunities to Salesforce?
Yes, crm.lead records in Odoo can be exported to Salesforce as either Leads or Opportunities, depending on their type in Odoo.
What should I do if a record fails to export to Salesforce?
The module logs errors to Odoo's log file (e.g., _logger.error). Check the Odoo server logs for detailed error messages, as these often include the Salesforce response which can pinpoint the exact issue (e.g., FIELD_INTEGRITY_EXCEPTION, missing required fields, permissions issues).
I'm getting "There is no Salesforce instance" error. What's wrong?
This error indicates that no Salesforce instance has been configured or that the configured instance is not set as the default one for your company. Go to the Salesforce configuration in Odoo and ensure an instance is properly set up and authorized.
Why might a ContentDocumentLink fail when exporting attachments?
Even if the attachment (ContentVersion) is created, linking it to a record can fail due to:
- Insufficient permissions for the Salesforce integration user on the target record (e.g., Quote, Sale Order).
- The target record itself is in a state that prevents linking (e.g., archived, read-only).
- Incorrect
ShareTypeorVisibilitysettings in theContentDocumentLinkpayload (less common for a "bad ID" error, but worth checking).
Always check Salesforce debug logs for the precise error.
I encountered "Please Select 1 record to Export" error.
This UserError is raised by the module when you try to manually export multiple records at once for certain objects (e.g., Products, Events) which are designed for single-record manual export. Select only one record at a time for manual export. Scheduled cron jobs will process multiple records automatically.
Why are some fields not synchronizing correctly?
Possible reasons include:
-
The field mapping in the integration code might be incorrect or missing.
- Salesforce field-level security or validation rules might be preventing the update.
- Data type mismatch between Odoo and Salesforce fields.
- The Odoo record's
x_is_updatedflag is not correctly set.
Review the specific sendDataToSf or create/update_sf_dict methods in the relevant Python file and check Salesforce validation rules/permissions.
Module Support & SLA
Our standard response time (SLA) for support queries is between 12 to 48 hours.
Please log in to comment on this module