> ## Documentation Index
> Fetch the complete documentation index at: https://docs.caard.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Odoo with several companies

> Send each lead to the right company when one Odoo database holds several.

One Odoo database can hold several companies, for example a US entity and a German subsidiary. Odoo keeps their records apart: a contact, salesperson or sales team can belong to one company, and Odoo refuses to link a lead in one company to any of them from another.

CAARD handles this for you. It decides which company each new lead belongs to, then only links that lead to contacts, companies, salespeople and teams that fit.

This page applies when the Odoo user behind your API key works in more than one company. With a single company, nothing here changes how leads sync.

## Set up the Odoo user

CAARD sees Odoo through the user whose API key you connected with. It can only see, search and create records in that user's companies.

**1. Give the user every company**

In Odoo, open **Settings → Users & Companies → Users**, open the integration user, and add every company your leads can belong to under **Allowed Companies**.

**2. Check the default company**

The user's **Default Company** is where leads go when nothing else decides. Pick the company most of your leads belong to.

**3. Give salespeople the right companies**

A salesperson can only own leads in companies they work in. Add each salesperson's companies under their own **Allowed Companies**.

**4. Refresh the Routing tab**

In CAARD, open **Integrations → Odoo → Routing** and select **Refresh from Odoo**. A **Company** picker appears once CAARD sees more than one company.

> [!WARNING]
>
> Contacts in a company the integration user can't access are invisible to CAARD. When a lead matches one of them, CAARD creates a new contact instead of reusing it.

## Which company a lead goes to

CAARD picks the first of these that applies:

1. **The lead is already in Odoo.** It stays in its company. CAARD never moves a lead between companies.
2. **A company is picked on the Routing tab** (for the lead's event or subteam override, or for Full Team).
3. **A sales team is picked on the Routing tab** and that team belongs to a company.
4. **The lead owner is mapped to an Odoo salesperson.** CAARD follows Odoo's own rule: the integration user's default company if the salesperson works there, otherwise the salesperson's default company.
5. **Otherwise**, the integration user's default company.

To control it, pick the company on the Routing tab rather than relying on teams or salespeople.

## Send events and subteams to different companies

The Routing tab follows the **Configuring for** menu, so each override can have its own company.

**1. Create or pick an override**

In **Configuring for**, pick the event or subteam, or create an override for it.

**2. Pick the company**

On the **Routing** tab, choose the **Company**. The **Sales team** list then shows only that company's teams and teams shared by all companies, each labelled with its company.

**3. Save**

Select **Save changes**. New leads from that event or subteam go to the company you picked. Leads already in Odoo stay where they are.

Changing the company clears a picked sales team that belongs to another company.

## What CAARD links to the lead

Once the company is settled, CAARD keeps everything it links to the lead inside it:

| Record | What CAARD does |
| - | - |
| Contact | Reuses a matching contact (same email, or phone if you turned that on) only if it's shared by all companies or belongs to the lead's company. A contact that belongs to another company is left alone, and CAARD creates a shared one. |
| Company | Same rule: it reuses a company record that's shared or belongs to the lead's company, otherwise it creates one. |
| Salesperson | Set only if they work in the lead's company. Otherwise the lead syncs without them, and the job in Sync History says so. |
| Sales team | A routed team of another company is skipped, with a note on the job. |

New contacts and companies CAARD creates are shared by all companies, so any company can reuse them later.

## Example

Acme has **Acme US** (the integration user's default) and **Acme DE**. The trade fair in Munich has an event override routed to **Acme DE**.

* A visitor scanned at the Munich booth becomes a lead in **Acme DE**, even if the rep who owns the lead is mapped to a salesperson who works only in Acme US. That salesperson is left off the lead, and Sync History notes it.
* The visitor already exists in Odoo as a contact that belongs only to Acme US. CAARD creates a new shared contact for the Acme DE lead and leaves the Acme US contact alone.
* A lead captured at a US event without an override goes to **Acme US**.

## Messages you might see

These appear on jobs in **Sync History**.

| Message | What it means | What to do |
| - | - | - |
| The lead owner's Odoo salesperson doesn't work in the lead's Odoo company | The lead synced without a salesperson | Add the company to that user in Odoo, or route the owner's leads to their company |
| Routing skipped the sales team because it belongs to another Odoo company than the lead | The picked team and the picked company don't match | Pick a team of that company on the Routing tab |
| Routing's company isn't one the Odoo API user works in | The integration user lost access to that company, so Odoo picked the company | Give the integration user that company again, or pick another |
| Routing skipped the sales team because Odoo didn't find it | The team was deleted or archived, or it belongs to a company the integration user can't access | Pick another team, or give the integration user that company |
| Records belong to different Odoo companies | Odoo still refused a link between companies, for example a field mapping that points at a record of another company | Check your field mappings for records that belong to one company, then select **Retry** |

## Things to know

* CAARD reads the integration user's companies at the start of each sync, so a change in Odoo applies to the next sync. Select **Refresh from Odoo** to update the Routing tab's lists.
* Leads that synced before you picked a company keep their company.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.