Tutorial - Odoo + AI agents

Connect your Odoo to Claude with an API Key and build your own views without writing Python

A thread in the Odoo Mexico Facebook group reminded us of something uncomfortable: the open source community had already solved this problem before the consultant showed up to quote thousands of dollars. Here is the how, for any version and any edition of Odoo, and here are the downsides almost no one tells you about.

Short answer. To query reports or build views with AI in any Odoo (Community or Enterprise, from v14 to v19) you do not need to buy a closed module: you generate a native API Key (Profile, Preferences, Security), connect it to an AI agent through an MCP server, and describe in plain language the view you want. The agent writes native Odoo XML, without a single line of Python. The limits that do matter: it is not a high-availability service, the key inherits all the user's permissions, and on Odoo Online the Python code (not the XML) can be billed as lines of code.

The spark: a fair question and eight expensive answers

In the Odoo Mexico Facebook group, someone asked what many of us have thought at some point (originally in Spanish):

"Who has a module to query reports with AI for Odoo Community?"

The answers were predictable: "happy to build it for you," "we already have one up and running," "hi, we can gladly help you," "we can do it for you at a good price." A community doing what it does best: quoting.

And in the middle of the thread, the answer that is rarely said out loud:

"Why not just generate the API Key and hand it to any AI agent so it sets up the MCP connection and builds your custom views?"

Any version of Odoo. Any edition. Without installing third-party modules. Without quoting anything. Without writing a single line of Python.

This article is the long, honest version of that answer. With the step by step, yes, but also with the fine print most posts skip: the technical debt you introduce, the dependence you create, the Odoo charges you can trigger without realizing it, and why this does not replace a good consultant, it empowers one.

What Odoo already ships out of the box and almost no one uses

Before the tutorial: for years Odoo has shipped, inside the Technical menu, a toolbox most users do not know exists:

None of this needs Python. It is composed with XML and QWeb, which is HTML with superpowers. If you ask a language model to write that view for you, it writes it without trouble, because the public Odoo corpus has been full of exactly that for more than a decade.

The "AI module for reports" they will quote you for thousands of dollars is, in most cases, exactly this wrapped in a manifest.

Mind map of the Odoo Technical menu: the User interface branch groups Custom views, Menu items, and User filters; the Data structure branch groups Models, Fields, and Field selection; everything is composed with XML and QWeb, without Python.
Diagram source (Mermaid)
mindmap
  root(("Odoo
Technical menu")) User interface Custom views Menu items User filters Data structure Models Fields Field selection All without Python XML and QWeb
The toolbox Odoo already ships in the Technical menu. None of this requires Python.
Flowchart: the user generates an API Key in Odoo, passes it to an AI agent with an MCP server, the agent reads the model's real schema, writes the custom view in XML, and the user verifies it in the browser.
Diagram source (Mermaid)
flowchart LR
    U(["User"]) -->|"1. Generate"| K["API Key in Odoo\nProfile, Preferences, Security"]
    K -->|"2. Configure"| M["AI agent + MCP server"]
    M -->|"3. Read real schema"| S[("Models and fields\nfields_get / list_models")]
    S --> M
    M -->|"4. Write"| V["Custom view\nXML / QWeb, no Python"]
    V -->|"5. Verify in browser"| U
The full pattern: the API Key is the key, the MCP is the bridge, and the agent writes native Odoo XML. The human verifies.

Tutorial: how to connect it yourself, step by step

The five steps in sequence: Step 1 generate the API Key in Profile, Preferences, Security; Step 2 connect the Odoo MCP to the agent; Step 3 describe the view in plain language; Step 4 verify in the browser (highlighted); Step 5 save a record of the change.
Diagram source (Mermaid)
flowchart LR
    P1["Step 1\nGenerate the API Key\nProfile, Preferences,\nSecurity"] --> P2["Step 2\nConnect the Odoo\nMCP to the agent"] --> P3["Step 3\nDescribe the view\nin plain language"] --> P4["Step 4\nVerify in\nthe browser"] --> P5["Step 5\nSave a record\nof the change"]
    style P4 fill:#E14228,stroke:#E14228,color:#FFFFFF
Five steps. The fourth one, verifying in the browser, is the one almost every tutorial omits.

Step 1: generate your API Key in Odoo

Inside Odoo, with your user: Profile, Preferences, Account or Security tab, New API Key.

Give it a descriptive name (for example, claude-mcp-september2026). Odoo shows you the key only once, so copy it immediately into a password manager. If you lose it, you generate another one; it is not recoverable.

It works on Community, Enterprise, Odoo Online, and Odoo.sh. It works on v14, v15, v16, v17, v18, and v19. It is a native mechanism, not a trick.

Step 2: register an Odoo MCP in your AI agent

MCP stands for Model Context Protocol, the open standard that connects AI agents with real systems.

Choose the connector your stack supports:

Your MCP needs four pieces of information:

ODOO_URL=https://your-instance.odoo.com
ODOO_DB=your-database-name
ODOO_USER=user-that-generated-the-key
ODOO_API_KEY=the-key-from-step-1

Step 3: describe to the AI what you want, in plain language

A real instruction that works:

"In the Sales module, create a list view of quotations (sale.order in sent state) older than 7 days since creation, grouped by salesperson and by sector tag. Columns: number, customer, salesperson, total amount, days since it was sent. Hang it under the menu Sales, Reporting, Stalled quotations."

The agent will do three things:

  1. Query the real schema (fields_get on sale.order) so it does not invent fields.
  2. Generate the view XML, the window action, and the menu item.
  3. Write it directly through the API, or hand it to you so you paste it manually into Custom views.

Step 4: verify before you believe

This is the step half of the tutorials omit. Before accepting the view as good:

If something looks off, ask the agent to read back the view it just created. Yes, the AI makes mistakes. The difference is that now you fix it in two messages, instead of waiting two weeks on a consulting ticket.

Step 5: save a record of the change

Note somewhere (a document, an internal note) which view you created, with what instruction, on what date, and which user held the API Key. This step seems optional. It is not. The cons section explains why.

The uncomfortable reflection: the rent-seeking of the traditional consultant

This is where the article gets dense, so I will say it plainly.

A senior consultant with ten years in Odoo can read this and feel two things at once:

  1. "They are killing my business." Invoices of five, eight, fifteen thousand dollars for a reporting module that an advanced user can clone in an afternoon with an AI agent and an API Key.
  2. "Finally I can stop selling this." Because deep down, billing dozens of hours for a custom view was never the work one imagined when studying systems architecture.

The open source community has been recommending this path for years. Custom views, Studio in Enterprise, the JSON-RPC API, XML development without Python: all of it has been in the official Odoo documentation for more than a decade. What changed in 2024 and 2025 was that a tool appeared, AI agents with MCP, that drops the cost of writing that XML from "a consultant with years of experience" to "an advanced user with patience and good questions."

This change does not eliminate serious consulting. Serious consulting is data architecture, process decisions, security, access control, migrations, integration with the SAT and CFDI, fiscal discipline, and ERP governance. All of that still requires a human being with judgment.

What it does eliminate, and not a moment too soon, is rent-seeking consulting: the kind that bills hours for what today is a click, an instruction, and a native menu. The consultants, developers, and technical project managers who cling to that model are going to compete against increasingly autonomous end users. Those who evolve toward governance, architecture, and judgment are going to be paid better than ever, because the market will finally tell the difference.

Diagram: the Odoo consultant's work splits in two. The rent-seeking kind (billing hours for an ad-hoc view or report) is absorbed by the advanced user with AI. The serious kind (architecture, security, migration, ERP governance) still requires human judgment.
Diagram source (Mermaid)
flowchart TD
    C["The Odoo consultant's work"] --> R{"What kind of work?"}
    R -->|"Rent-seeking"| X["Billing hours for a view\nor an ad-hoc report"]
    R -->|"Serious"| K["Architecture, security,\nmigration, ERP governance"]
    X --> XD["Absorbed by the advanced\nuser with AI"]
    K --> KP["Still requires\nhuman judgment"]
    style XD fill:#7a2018,stroke:#E14228,color:#FFFFFF
    style KP fill:#14532d,stroke:#3ba55d,color:#FFFFFF
The technique does not erase serious consulting. It erases the rent-seeking charge for what today is a supervised click.

Pros, in short

Cons: the fine print almost no one tells you about

This section is the real reason this article exists. The pros are already sold to you everywhere; the cons, rarely.

Mind map of the balance: the pros are speed, no vendor lock-in, conversational iteration, and work inside the core; the cons are technical debt, dependence on the owner's machine, billable lines of code, and access control.
Diagram source (Mermaid)
mindmap
  root(("API Key + AI
in Odoo")) Pros Speed No vendor lock-in Conversational iteration Inside the core Cons Technical debt Dependence on the machine Billable LoC Access control
The balance at a glance. The four cons are the ones that rarely appear in the pitch.
Decision diagram: on Odoo Online, XML views and Studio with simple logic are safe and do not count as lines of code, while server actions and automations with Python are counted as billable lines of code.
Diagram source (Mermaid)
flowchart TD
    A["You ask the AI for a change"] --> B{"Does it need Python?"}
    B -->|"No: XML / QWeb / view"| C["Safe\nDoes not count as LoC"]
    B -->|"Studio with simple safe_eval"| C
    B -->|"Yes: def / class / import\nin a server action"| D["Odoo counts it\nas lines of code"]
    D --> E{"Are you on Odoo Online\nor Odoo.sh?"}
    E -->|"Yes"| F["May be billable\nby Odoo SA"]
    E -->|"No: Community self-hosted"| G["Not billed,\nbut it is technical debt"]
The red line: XML is not charged, Python is counted. And counting is not the same as documenting.

1. Invisible technical debt

A view created through conversation with AI does not live in a git repository. There is no diff, no peer review, no history of "who changed what and why" beyond the record's write_uid and write_date.

In practice this means that:

It is the equivalent of building on a house with no blueprints: it works, until you have to remodel.

Comparison: a view created by conversation has no git repository, no diff or review, and in a migration it breaks silently. A module under version control lives in git, has diff, PR, and tests, and in a migration it is reproducible.
Diagram source (Mermaid)
flowchart LR
    subgraph IA["View created by conversation"]
      I1["No git repository"] --> I2["No diff or review"] --> I3["Migration:\nbreaks silently"]
    end
    subgraph GIT["Module under version control"]
      G1["Lives in git"] --> G2["Diff, PR, tests"] --> G3["Migration:\nreproducible"]
    end
    style I3 fill:#7a2018,stroke:#E14228,color:#FFFFFF
    style G3 fill:#14532d,stroke:#3ba55d,color:#FFFFFF
The same customization, two different life cycles. The difference is paid in the next migration.

2. Dependence on the owner's computer

This is the point that gets most underestimated. The API Key lives on your machine: in your local MCP configuration file, in the Claude Desktop config, in your editor's mcp.json. On a specific, physical laptop, one that can die.

Consequences:

It is different from a third-party module, which at least lives in addons with its manifest, or a change made by an external consultant, who at least leaves a closed ticket and an invoice as a trail.

3. Responsibility toward Odoo: the famous lines of code

This is the point that came up in the original thread and deserves a paragraph of its own.

On Odoo Online (SaaS) and Odoo.sh, modifications are counted and can be billable as customization, according to Odoo SA's commercial model. The practical operating rule:

If you ask the AI to "solve" a complex calculation by writing you a thirty-line Python server action, congratulations: you just generated technical debt and, on top of that, a variable cost with Odoo SA.

A tip that comes from the thread itself: if Odoo tries to charge you for lines of code for customizations, ask them for the audit report without HTML lines, because HTML, XML, and QWeb should not count as Python code, and that report lets you see the raw tally.

4. Access control: the blast radius problem

The Odoo API Key inherits all the permissions of the user who generated it. That is by design. There are no per-operation granular permissions in standard Odoo.

Consequences:

Non-negotiable best practice:

  1. Create a dedicated user, for example [email protected].
  2. Assign minimum groups: read-only wherever possible, write only on the models it needs.
  3. Generate the API Key from that user.
  4. Never use the API Key of an administrator user.
  5. Rotate the key every 60 or 90 days.
  6. Record which agent and which machine is using it.
Blast radius comparison: using the administrator API Key makes the agent inherit all permissions and the blast radius is the entire ERP. Using a dedicated ai-bot user with minimum permissions contains the blast radius.
Diagram source (Mermaid)
flowchart TD
    subgraph MAL["Risky"]
      A1["Administrator's API Key"] --> A2["The agent inherits\nALL permissions"] --> A3["Blast radius:\nthe entire ERP"]
    end
    subgraph BIEN["Recommended"]
      B1["Dedicated ai-bot user"] --> B2["Minimum permissions,\nonly what is needed"] --> B3["Blast radius:\ncontained"]
    end
    style A3 fill:#7a2018,stroke:#E14228,color:#FFFFFF
    style B3 fill:#14532d,stroke:#3ba55d,color:#FFFFFF
The same connection, two blast radii. The API Key inherits the permissions of the user who generated it: choose that user well.

5. Reproducibility and environments

There is no staging-to-production path for a view created through conversation. If your instance gets corrupted and you restore a backup from two weeks ago, all the views created after that date disappear, unless you exported them by hand or documented their source instruction to regenerate them.

In a traditional module under git, a checkout reproduces the state. Here it does not.

6. Knowledge continuity

If the user who conversed with the agent to create the view leaves the company, who knows what instructions they used, what computed fields exist, what depends on what. Without intentional documentation, each customization created this way is a small black box.

7. Schema hallucination

An agent without access to the real schema can invent fields that do not exist. The view compiles badly, or compiles fine but shows empty for everything. Best practice: ask the agent to always validate against the real model before writing. Mature connectors expose that capability; use it.

When to use this pattern and when not to

Decision tree: if you are going to build an ad-hoc report, pilot, or prototype, go ahead yourself as a power user with judgment. If it is a critical process, CFDI, security, or a formal go-live, do it with professional support: consultant plus ERP governance.
Diagram source (Mermaid)
flowchart TD
    Q{"What are you going to build?"} -->|"Ad-hoc report,\npilot, prototype"| SI["Go ahead yourself"]
    Q -->|"Critical process, CFDI,\nsecurity, formal go-live"| NO["With professional\nsupport"]
    SI --> SI2["Power user\nwith judgment"]
    NO --> NO2["Consultant + ERP\ngovernance"]
    style SI fill:#14532d,stroke:#3ba55d,color:#FFFFFF
    style NO fill:#7a2018,stroke:#E14228,color:#FFFFFF
The golden rule: the higher the criticality and fiscal risk, the less improvisation and the more governance.

When yes:

When no, without professional support:

The real role of the consultant, the developer, and the technical PM

I will close with this, which is the reason Transgenia publishes this article instead of keeping it to itself.

This technique does not replace the serious consultant. It empowers them to stop charging for consulting on what today is a supervised click.

And it frees the technical project manager and the senior developer for the work that does require judgment and experience:

At Transgenia we use exactly this pattern: an MCP connector to Odoo, a dedicated user with minimum permissions, and a human consultant governing what the agent writes. Not to save ourselves billing hours, but to free them toward work that does build long-term value.

If you are going to try it yourself, welcome to the club: you already know how to start. And if it happens that the view breaks production, that Odoo starts charging you for lines of code, or that the API Key leaked, that is exactly when a call is worth it. That, precisely, is the work that does not disappear.

Frequently asked questions

Do I need the Odoo.sh or Enterprise version to connect an AI agent?

No. The API Key and API access exist in every edition, including Community self-hosted, and in every recent version (v14 onward). What changes between editions is not the ability to connect, but the commercial consequences of adding Python lines of code: on Odoo Online and Odoo.sh they are counted; on Community self-hosted, they are not.

Will building views with AI cost me lines of code billable by Odoo?

If you stick to custom views in XML, fields, and menus, no. Those customizations do not count as lines of code. The charge appears when you ask for logic in Python (server actions, automations with code). If you are on Odoo Online, stay in configuration, Studio, and XML; leave Python for cases a consultant has evaluated.

Is it safe to give my API Key to an AI agent?

It depends on which user generated it. An API Key inherits all of that user's permissions, with no granularity. Never use the administrator's. Create a dedicated user with minimum permissions, generate the key from there, rotate it every 60 or 90 days, and record which machine uses it. That is how you contain the blast radius if the key leaks.

So do I no longer need an Odoo consultant?

For a view or an ad-hoc report, a power user with judgment probably no longer needs one. For architecture, security, migrations, fiscal integration, and ERP governance, yes. The technique eliminates rent-seeking consulting (billing hours for what is a click), not serious consulting.

What happens to these views when I migrate Odoo versions?

That is the biggest risk. Since they do not live in a git repository and have no automated tests, they can break silently during a migration and no one knows where to look. Document each view (what instruction created it, on what date, what fields it uses) or export it, so you can reproduce it later.

About the author and Transgenia

Efraín Carreón Ortiz is Director General of Centrum Transgenia, a Mexican technology boutique. He holds the official Claude Code badge (Claude Partner Badge) issued by Anthropic, verifiable on Credly.

Transgenia is an OpenAI Select Partner in the OpenAI Partner Network and a registered partner in Anthropic's Claude Partner Network. We run twelve governed AI agents in our own production and support verifiable implementations in healthcare and B2B.

Let's talk: LinkedIn, a 15-minute call, or the contact page.

Keep reading

← Back to Blog