Odoo connector
Import customers, their people and the product catalog with price lists from an Odoo ERP and keep them current.
The Odoo connector plugin (odoo-connector) reads customers from an Odoo ERP and keeps them in the CRM as accounts, with their people as contacts. It also brings in Odoo's product catalog and chosen price lists, so the CRM prices exactly like Odoo. It reads from Odoo, and writes there only when you turn on sending orders: then READY orders become draft sale orders in Odoo (see Orders).
What it does
- Every Odoo customer (a company or a person with a customer rank above zero, no parent, active) becomes an account. An existing account is reused when it matches (see below); otherwise a new one is created.
- People under those customers (child contacts of type "contact") become contacts on the account.
- After the first import, the plugin checks Odoo for changed partners every
syncMinutesminutes and updates the CRM.
Before you start
- Odoo 18 or later (the plugin uses Odoo's JSON-2 API).
- An Odoo user for the CRM with an API key. It needs read access to contacts (partners), countries, users, products, product categories, taxes, price lists, sales orders, deliveries and invoices. It needs write access only for sending orders: create on contacts and sales orders.
Install and settings
Install it under Admin → Plugins → Odoo connector.
| Setting | Default | Effect |
|---|---|---|
url | none | The Odoo address, starting with https://, for example https://odoo.example.com. |
database | none | The Odoo database name. |
syncMinutes | 15 | Minutes between syncs, 5 to 1440. The check runs every 5 minutes, so a sync can start up to 5 minutes later. |
defaultCountry | CZ | Two-letter country code for customers without a country in Odoo. |
dryRun | on | While on, the sync only writes to the plugin log what it would create or change, and the scheduled sync is paused: use Sync now. |
priceLists | empty | The Odoo price lists to import: their Odoo ids, separated by commas, for example 242, 245. See Catalog. |
sendOrders | off | Send orders in READY to Odoo as draft sale orders. While off, the connector never writes to Odoo. |
fillOwners | on | Give an existing account without an owner the CRM user of its Odoo salesperson. See Owners. |
timeZone | UTC | The time zone the plugin's screens and emails show times in, for example Europe/Prague. |
The secret apiKey holds the Odoo user's API key. It is stored encrypted.
Dry run first
A new install starts in dry run. Use Test connection to check the address, database and key: it shows the Odoo version and the API user's name. Then click Sync now and read the plugin log: it lists every account and contact the sync would create or update, and every customer that matches more than one account. When the list looks right, turn dryRun off in the settings and click Sync now again.
How customers are matched
For each Odoo customer the plugin tries, in this order:
- an account it already linked to this customer;
- an account with the same country and registration number (spaces are ignored; Czech numbers are compared with leading zeros to 8 digits);
- an account with the same VAT number;
- otherwise it creates a new account.
A match in step 2 or 3 is not linked straight away. The customer is listed under Link proposals (sidebar, Plugins group; managers and admins), with the matching account and the reason, and managers and admins get an email once per sync that adds proposals. Until someone decides, the customer gets no account and its people and orders are not imported.
- Confirm links the two on the next sync (queued at once): the account gets the Odoo fields and the Odoo panel, as an automatic link did before. This holds even if the customer was archived in Odoo meanwhile; it is then linked as archived.
- Reject means they are different companies: the next sync creates a new account for the customer, and this pair is never proposed again.
Customers already linked keep syncing as before. Confirm is refused if another Odoo customer was linked to the account in the meantime. Confirm and Reject are both refused once the customer is linked (for example by a sent order) or the account was deleted; reload the page.
When two or more accounts match in step 2 or 3, or the matching account is already linked to another Odoo customer, the plugin links nothing and lists the customer under Customers matching more than one account on the plugin's admin page. Fix it in the CRM (correct or remove the duplicate) and the next sync proposes the link, even if nothing changed in Odoo.
Sending an order still links an account to the Odoo customer it finds without a proposal (see Orders), and that closes the customer's open proposal. A customer rejected for the account is skipped: order send takes the next Odoo customer with the same number, then falls through to the VAT match, and creates a new Odoo customer only when neither finds one. The sync does not fall through: a customer rejected for an account always gets its own account.
Upgrading to 0.5.0: existing links stay as they are. Customers that are not linked yet and match an account now wait under Link proposals instead of being linked on the next sync. After the upgrade, check that page, especially on a first import with many existing accounts.
Owners
An account gets an owner when the customer's salesperson in Odoo has the same email (upper or lower case does not matter) as an active CRM user. The plugin takes the Odoo user's email, or the login when the email is empty. Otherwise the account has no owner and appears on the Needs owner page (under Plugins in the menu, for managers and admins), with the Odoo salesperson's name.
New accounts get the owner when the sync creates them. With fillOwners on, an existing account without an owner gets one the next time its customer changes in Odoo, for example when you create the salesperson's CRM user and then reassign or edit the customer in Odoo. A sync never replaces an owner that is already set. The new owner starts the account's protection like any other assignment.
What Odoo controls
Odoo wins for these account fields: name, registration number, VAT number, billing street, city, postal code, region, country, email and phone. When a customer changes in Odoo, the next sync writes these fields to the account, even if someone edited them in the CRM. A field that is empty in Odoo never clears a value filled in the CRM.
The sync never touches anything else: an owner already set in the CRM, the shipping address, the price list, notes, activities and all other fields. The account's Odoo panel shows the link to the Odoo partner and when it was last synced.
Archived customers
When a customer is archived in Odoo, or stops being a customer, nothing is deleted in the CRM. The account's Odoo panel shows the change. If the customer becomes active again, it syncs as before.
Catalog
Every sync also brings in the catalog:
- Categories: all Odoo product categories, as a tree.
- Products: every sellable Odoo product variant becomes a product, with its SKU, price, cost, sales tax, unit and category. A variant that is archived or no longer sold in Odoo is archived in the CRM, never deleted.
- Price lists: the lists in
priceLists, with all their rules. Lists they build on (for example a base list that is archived in Odoo) come along automatically as inactive lists, marked Base for other lists; reps don't pick them, but prices are computed through them. - Account price lists: a linked account gets its Odoo customer's price list, when that list is imported. The account's Odoo panel shows the Odoo list, or that it is not imported.
Products, categories and these price lists are read-only in the CRM: change them in Odoo. To choose lists, click Load price lists on the plugin's admin page: it shows every Odoo list with its id. Put the ids in priceLists and save.
A list you remove from priceLists stays in the CRM as an inactive list, so older orders keep it, and is no longer given to accounts. A list is skipped, with a line in the plugin log, when a list it builds on can't be read with the Odoo user's access, or when it builds on more than 10 other lists.
Rules the CRM cannot use are listed on the admin page under Rules the CRM cannot use. The same list notes rules Odoo ranks differently from the CRM (a rule on one product variant next to a rule on the whole product). A product created by hand in the CRM with the same SKU as an Odoo variant is taken over: it keeps its id (so orders and price list rules that use it stay intact), becomes the Odoo product and is kept current from Odoo from then on; the plugin log says "Took over CRM product …". A deleted CRM product, or a product of another plugin, with the same SKU is never taken over: that variant is not imported, the plugin log names it and the next syncs try again.
Compare with Odoo
Compare with Odoo checks that the CRM prices like Odoo. For each list in priceLists it picks up to 20 products, covering the kinds of rules on the list, and prices each at quantity 1, at the minimum quantity of the rule that prices it, and one below. Odoo prices the same lines without saving anything. The admin page then shows, per list, how many prices matched, and every difference with the reason:
- price rule: the CRM and Odoo apply a rule differently. Report it.
- exchange rate: Odoo converted the product price into the list currency with its rate of the day, and the CRM's rate for that day differs. Keep the CRM's exchange rates in line with Odoo's.
Failures
Sync now and Compare with Odoo are queued and start within 5 minutes. A failing sync is logged in the plugin log with the reason, for example when Odoo rejects the API key, or denies access to a model the Odoo user cannot read (the log names it). The next run repeats everything since the last good run; a customer or person that failed on its own is tried again on every run until it succeeds. After three failed runs in a row, admins get one email.
Orders
With sendOrders on (and dry run off), an order that becomes READY goes to Odoo within seconds; a check every 5 minutes picks up anything missed.
What the connector does in Odoo, and nothing else:
- finds the customer (by the account's link, registration number, then VAT; by exact name when the account has neither) or creates it and links the account; a customer already linked to another account is never moved (the order fails, see below);
- uses the customer or one of its delivery addresses when the order's delivery address matches, or creates a delivery address;
- creates a draft sale order: the CRM order number in Source document (
origin), the CRM unit prices, the account's Odoo price list (or the customer's), the salesperson by email, the rep's name and the order note in the note.
Odoo confirms the order; the connector never confirms, edits or cancels it.
The Odoo user needs create on contacts (res.partner) and sales orders (sale.order, sale.order.line) and read on everything else the connector reads. No delete, no accounting rights.
Status
| Odoo | Order status |
|---|---|
| quotation | SENT |
| confirmed | CONFIRMED |
| everything shipped | DELIVERED |
| fully invoiced | INVOICED |
| fully invoiced and every invoice paid | PAID |
| cancelled | CANCELLED |
Statuses are read on every sync (syncMinutes). They only move forward; partly shipped or partly paid orders keep the earlier status and the Odoo panel on the order shows the details: deliveries, invoices with what is left to pay, a "Price differs from Odoo" list when Odoo's price list would charge more than 1 more or less than the order, and a note when someone changed the order's total in Odoo.
When the connector can no longer find the Odoo order, the order keeps its status and the panel says "Not found in Odoo"; admins get one email. Odoo gives the same answer for a deleted order and for one the API user lost access to, so the connector never cancels on its own: if the Odoo order was deleted, cancel the CRM order by hand.
When sending fails
- Odoo unreachable: the order stays READY and goes out when Odoo is back; the panel shows since when it waits. An order reopened or cancelled while it waits starts afresh when it is submitted again.
- Odoo refuses access (wrong key or missing rights): sending pauses for every order and admins get one notification. Fix the rights, then click Test connection.
- Odoo refuses the order: after 5 refusals, or at once for a product that does not come from Odoo, a currency that differs from the Odoo price list, an order already in Odoo with other lines, or an Odoo customer already linked to another account, the order becomes SYNC_FAILED and admins are notified. Fix the cause and click Retry on the order.
Sending is safe to repeat: whatever fails in between, each order exists once in Odoo.
Orders from Odoo
Every sync also brings in the confirmed Odoo orders of customers linked to an account, including everything from before the link. Quotations and orders cancelled before they were imported stay out. An imported order:
- is read-only in the CRM, numbered from the CRM's order series, owned by the account's owner, with the Odoo order date, currency and note;
- has its product lines at Odoo's unit price, after any line discount. Notes, section headings and down payments are skipped. A product that is archived in Odoo (for example an old batch) is added to the CRM as an archived product, so the order is complete; reps cannot order it. Only a line whose product cannot be created in the CRM is left out, and the order note says how many lines are not shown; once the product exists, the next sync fills those lines in. VAT comes from the CRM product, so the CRM total can differ slightly; the order's Odoo panel then shows Odoo's total;
- follows Odoo's status like an order sent from the CRM, and its lines are updated when they change in Odoo.
Orders the CRM sent to Odoo are never imported again. If an imported order moves to another customer in Odoo, the CRM order keeps its account, its panel says "Customer changed in Odoo" and admins get one email. At most 200 orders are imported per sync; a large first import spreads over several syncs. An order that cannot be imported (for example its currency does not exist in the CRM) is listed on the admin page and tried again on every sync.
The Odoo tab on the account
Linked accounts get an Odoo tab: the account's orders that exist in Odoo (newest 50, with the Odoo number, total without VAT and status), the open invoices and credit notes with what is owed (overdue ones in red), and the confirmed orders without VAT for this year and last year. The tab shows the data of the last sync ("As of …") and opens even when Odoo is down.