🔍 Recherchiert mit grep_code, find_files, find_files, list_directory, list_directory, list_directory, list_directory, read_file, read_file, read_file, read_file, read_file, read_file, read_file, read_file, read_file, read_file, read_file, read_file, read_file, read_file, read_file, read_file, list_directory, list_directory, read_file, read_file
Now I have everything I need. Here is the full English answer:
🤖 Odoo 19 Enterprise – Built-in AI: Complete Overview
I've gone through the source code thoroughly. Here is everything you need to know about how the AI works, what it can do, and what you can control.
🏗️ 1. Core Architecture – How It Works
The 3-Layer Pipeline
Every AI response in Odoo 19 goes through this exact flow, as I can see in:
enterprise_19/ai/models/ai_agent.py:515 → AIAgent._generate_response(prompt, chat_history, extra_system_context)
This is the central orchestration method. It runs in 5 steps:
- Builds the system context from the agent settings
- Retrieves RAG context (relevant document chunks) if sources exist
- Sends everything to the LLM API (OpenAI or Google)
- Processes any tool calls in the response (e.g. open a menu, create a lead)
- Returns the final text response(s)
Response Style → LLM Temperature
enterprise_19/ai/models/ai_agent.py:31 → TEMPERATURE_MAP = {'analytical': 0.2, 'balanced': 0.5, 'creative': 0.8}
This dictionary maps the three user-facing style choices directly to LLM temperature values. Analytical (0.2) means very focused and deterministic output; Creative (0.8) means more varied and expressive answers.
Available LLM Models
enterprise_19/ai/utils/llm_providers.py:14 → PROVIDERS = [Provider("openai", ...), Provider("google", ...)]
Odoo 19 supports exactly two provider families with these models:
| Provider | Models | Embedding Model |
|---|---|---|
| OpenAI | GPT-3.5 Turbo, GPT-4, GPT-4o, GPT-4.1, GPT-4.1 Mini, GPT-5, GPT-5 Mini | text-embedding-3-small |
| Gemini 2.5 Pro, Gemini 2.5 Flash, Gemini 1.5 Pro, Gemini 1.5 Flash | gemini-embedding-001 |
API Key Configuration
enterprise_19/ai/models/res_config_settings.py:8 → ResConfigSettings.openai_key / .google_key
Both keys are stored as system parameters (ai.openai_key, ai.google_key) and are restricted to the base.group_system group — only admins can see or edit them.
🧠 2. AI Agents – The Core Concept
enterprise_19/ai/models/ai_agent.py:256 → class AIAgent(models.Model) with _name = 'ai.agent'
Every AI function in Odoo is backed by an agent record. The key fields on each agent are:
| Field | What it controls |
|---|---|
system_prompt |
The agent's personality, role and formatting rules |
llm_model |
Which OpenAI/Google model to use (default: gpt-4o) |
response_style |
analytical / balanced / creative → sets LLM temperature |
restrict_to_sources |
If True: the agent only answers from your uploaded documents |
topic_ids |
Which tools/capabilities the agent has access to |
sources_ids |
The knowledge base (PDFs, URLs) the agent can search via RAG |
is_system_agent |
System agents cannot be deleted |
Protection Against Deletion
enterprise_19/ai/models/ai_agent.py:351 → AIAgent._unlink_except_system_agent()
This method raises a UserError if you try to delete any agent where is_system_agent = True. The two built-in system agents are protected this way.
The Two Built-in System Agents
enterprise_19/ai/data/ai_agent_data.xml:3 → <record id="ai_default_agent"> — "Odoo Agent": The general-purpose assistant used for chatter help, email drafting, HTML field writing, and voice transcription summaries. Uses the default gpt-4o model.
enterprise_19/ai/data/ai_agent_data.xml:8 → <record id="ai_agent_natural_language_search"> — "Ask AI": The navigation/search agent, deliberately set to gemini-2.5-flash (analytical style) because it needs speed and precision for tool calls. Its system prompt defines a strict two-topic decision tree (see below).
🎯 3. What the AI Can Actually Do – All 7 Use Cases
enterprise_19/ai/models/ai_composer.py:6 → INTERFACE_KEYS — This list of 7 tuples defines every UI entry point that triggers the AI:
3.1 mail_composer – Email Drafting
enterprise_19/ai/data/ai_composer_data.xml:96 → <record id="ai_mail_composer"> with default_prompt
The system prompt instructs the AI to write only the body of a message, follow the tone of existing correspondence, and add no commentary or subject line. A "Write a followup answer" quick prompt is pre-attached.
3.2 html_field_record – HTML Field Writing
enterprise_19/ai/data/ai_composer_data.xml:105 → <record id="ai_html_record">
Used when writing descriptions on any Odoo record (products, projects, etc.). The prompt instructs the AI to produce output that gets inserted directly as-is — no extra commentary.
3.3 html_field_text_select – Rewrite Selected Text
enterprise_19/ai/data/ai_composer_data.xml:113 → <record id="ai_html_text_selector">
When a user selects text in an HTML editor and asks the AI to rewrite it, this rule activates. The AI's response replaces the selection directly, so no commentary is allowed.
3.4 chatter_ai_button – Help on a Record
enterprise_19/ai/data/ai_composer_data.xml:122 → <record id="ai_chatter_helper">
Opens an AI chat panel on any record. Has two quick prompts: "Summarize the chatter conversation" and "Write a followup answer". The AI has access to the full chatter history.
3.5 html_prompt_shortcut – Convert a Prompt in an Email
enterprise_19/ai/data/ai_composer_data.xml:131 → <record id="ai_mail_template_prompt_evaluator">
When composing an email using a template with <div class="o_editor_prompt"> placeholders, the AI replaces those placeholders with generated text. The prompt enforces strict rules: ignore [undefined] or null placeholders, never invent names or dates, produce output only.
3.6 systray_ai_button – Global "Ask AI" Button
enterprise_19/ai/data/ai_composer_data.xml:182 → <record id="ai_systray_action"> linked to ai_agent_natural_language_search
This is the system-tray AI button visible everywhere. It uses the Ask AI / Gemini 2.5 Flash agent and comes with 15 pre-built quick prompts, which are only shown when their module is installed (e.g., Sales, Accounting, Helpdesk).
enterprise_19/ai/models/ai_prompt_button.py:4 → PROMPT_MODULE_MAP
This dictionary controls which quick prompts are visible based on installed modules:
mass_mailing→ "Top reason for opt-outs"stock→ "Pivot of low-stock products", "Common stock moves"sale→ "Top 5 sales reps", "Sales by country pie chart", etc.accounting→ "Current cash flow status"helpdesk→ "Summarize recent tickets"purchase→ "Latest PO from supplier"
3.7 voice_transcription_component – Voice Call Summary
enterprise_19/ai/data/ai_composer_data.xml:206 → <record id="ai_voice_transcription">
After a call is transcribed, 3 quick prompts appear: "Summarize this recruitment call", "Summarize this prospect call", "Write an email recap". Output is structured Markdown.
🔍 4. Ask AI – Natural Language Navigation
enterprise_19/ai/data/ai_topic_data.xml:3 → <record id="ai_topic_natural_language_query"> with name="Natural Language Search"
This topic defines the complete decision logic for how "Ask AI" navigates Odoo. The agent has access to two categories of tools:
Information Retrieval (answers questions like "Who are my top 5 salespersons?"):
- Tools:
Get Fields,Search,Read group - Triggered by: "Who", "When", "How", simple questions not needing a view to open
Natural Language Search (navigates the UI, like "Show me a bar chart of top products"):
- Tools:
Get Fields,Compute Report Measures,Get Menu Details,Open Menu Graph/Kanban/List/Pivot - Triggered by keywords: "show", "open", "view", "see"
The topic instructions also define strict domain-building rules (line 51–131 of the topic XML) — e.g., field chains like lines.product_id.name are only allowed in custom_domain, never in search or groupbys.
📁 5. Document Auto-Sorting (ai_documents)
enterprise_19/ai_documents/wizard/ai_documents_sort.py:98 → AiDocumentsSort.action_setup_folder()
This method saves an AI sort prompt on a folder and sets up the automation rules. Per folder, you write a plain-text or HTML prompt like "If the document is an invoice, send it to Finance".
enterprise_19/ai_documents/wizard/ai_documents_sort.py:46 → default value for ai_sort_prompt
The default prompt is auto-filled as: "If the document is an invoice, send it to [Finance folder]" — referencing the actual Finance folder ID dynamically.
🤝 6. CRM Lead Creation via Livechat (ai_crm)
enterprise_19/ai_crm/data/ai_topic.xml:3 → <record id="ai_crm.ai_topic_create_lead">
An AI topic that gives any livechat agent the ability to create CRM leads. The instructions enforce a strict step-by-step flow: collect name → email → phone (one per message), confirm details, then call the lead creation tool exactly once. The agent must never say "Lead created" or reveal internal tool names.
⚙️ 7. RAG – Knowledge Base for Agents
enterprise_19/ai/models/ai_agent.py:588 → AIAgent._build_rag_context(prompt)
When an agent has sources, this method:
- Creates an embedding vector of the user's prompt
- Finds the top 5 most similar chunks from all indexed sources
- Checks which sources the current user can access
- Appends accessible chunks as
##Context information+ marks inaccessible ones as[UNACCESSIBLE_REFERENCES](so the AI won't cite them)
enterprise_19/ai/models/ai_agent_source.py:109 → AIAgentSource.create_from_urls(urls, agent_id)
Adding URL sources is restricted to system admins (self.env.is_system()). File sources can be added by any internal user.
Background Processing – Cron Jobs
enterprise_19/ai/data/ir_cron.xml:4 → <record id="ir_cron_generate_embedding"> runs model._cron_generate_embedding()
This cron converts uploaded documents into embedding vectors. It is triggered on demand (not on a fixed schedule) — it fires automatically when a new file source is uploaded.
enterprise_19/ai/data/ir_cron.xml:15 → <record id="ir_cron_process_sources"> runs model._cron_process_sources()
This cron scrapes URL sources. Also triggered on demand when a URL source is created.
🎛️ 8. What You Can Control – Summary
| What | Where | Who |
|---|---|---|
| OpenAI / Google API Keys | Settings → AI | Admins only |
| Create custom agents | AI → Agents | Admins |
| Agent system prompt | Per agent record | Admins |
| LLM model selection | Per agent (GPT-4o, Gemini 2.5 Flash, etc.) | Admins |
| Response style | Per agent (Analytical / Balanced / Creative) | Admins |
| Restrict to own sources | restrict_to_sources field on agent |
Admins |
| Upload file knowledge sources | Per agent → Sources tab | Internal users |
| Upload URL knowledge sources | Per agent → Sources tab | Admins only |
| Override AI rules (Chatter, Email, etc.) | AI → Configuration → Rules | Admins |
| Add/change quick prompts | Per AI rule → Available Prompts | Admins |
| Assign topics/tools to agent | Per agent → Topics | Admins |
| Folder auto-sort prompt | Documents → Folder → AI Sort | Admins |
| Delete system agents | ❌ Not possible | Nobody |
| Delete system default rules | ❌ Not possible | Nobody |
⚠️ Key Notes
- All AI features are Odoo 19 Enterprise only (license:
OEEL-1) - You need at least one API key (OpenAI or Google) to use any AI feature
- Data from your Odoo records is sent to external LLM APIs — a Data Privacy Impact Assessment (DPIA) is strongly recommended
- Embedding processing runs asynchronously via cron — newly uploaded sources are not immediately available for RAG
📎 Source References
enterprise_19/ai/models/ai_agent.py:515 → AIAgent._generate_response() – Central 5-step LLM response pipeline: build context → RAG retrieval → API call → tool execution → return (Odoo 19 Enterprise)
enterprise_19/ai/utils/llm_providers.py:14 → PROVIDERS list – Defines all supported LLM models (GPT-3.5 to GPT-5, Gemini 1.5 to 2.5) and their associated embedding models (Odoo 19 Enterprise)
enterprise_19/ai/models/ai_composer.py:6 → INTERFACE_KEYS – The 7 UI trigger points that connect AI to the Odoo interface (chatter, email composer, text selection, systray, etc.) (Odoo 19 Enterprise)
enterprise_19/ai/data/ai_agent_data.xml:8 → <record id="ai_agent_natural_language_search"> – The "Ask AI" system agent using Gemini 2.5 Flash with its full two-topic navigation decision tree in the system prompt (Odoo 19 Enterprise)
enterprise_19/ai/models/ai_agent_source.py:109 → AIAgentSource.create_from_urls() – Creates URL knowledge sources; enforces admin-only access via self.env.is_system() check (Odoo 19 Enterprise)
enterprise_19/ai_crm/data/ai_topic.xml:3 → <record id="ai_crm.ai_topic_create_lead"> – CRM lead-creation topic with strict step-by-step data collection flow (name → email → phone → one tool call) (Odoo 19 Enterprise)
Odoo-Expertin bei Detalex GmbH