SaaS DiaryA solo developer's diary of building and running software

Home › Tech log

Tech log

Make AI agent changes in Odoo wait for approval (ChatGPT, Claude, MCP, n8n, Odoo 20)

Why an API key can confirm orders and post invoices, what the free options do, and how to put a person between the agent and your data

Published Author GRAMSHIFT5 min read

Contents
  1. What happens when an AI agent calls Odoo
  2. Is there an approval feature in standard Odoo?
  3. Free ways to limit what an agent can change
  4. Hold the agent's changes until a person approves them
  5. Frequently asked questions

Standard Odoo 20 cannot make an AI agent's changes wait for approval, apart from purchase orders above an amount: a call made with an API key runs at once, with the rights of the key's user. If ChatGPT, Claude, an MCP server or n8n may edit a quotation, it may also confirm it; if its user has Billing rights, it may also post invoices. Below: what standard Odoo offers, free ways to limit the damage, and how to put a person between the agent and your data, checked against the Odoo 20 source and on a local Odoo 20 server.

  • API calls run immediately. JSON-2 (/json/2/<model>/<method>), XML-RPC and JSON-RPC check the key, then run the method. Nothing in between asks anyone.
  • Access rights are mostly per model, not per action. Confirming a sales order needs only the right to edit it, and posting an invoice needs only the Billing rights that also allow editing it.
  • Free options reduce what the key can do, or ask the agent to leave changes as drafts, but do not hold a change for someone to approve.
  • An approval module can turn the agent's changes into requests that a person approves or refuses in Odoo.

What happens when an AI agent calls Odoo

MCP servers for Odoo, n8n's Odoo node and most scripts written by ChatGPT or Claude use an Odoo API key, created under My Preferences, Security, Create API Key. Each call names a model and a method, for example sale.order and action_confirm. Odoo checks the key, finds its user and runs the method as that user. For JSON-2 the whole controller is a few lines: find the model, find the method, call it.

So the limit is the user's access rights, and those are mostly set per model: read, write, create, delete. A button is a method of the record. In Odoo 20, sale.order.action_confirm checks no group beyond the right to edit the order, and account.move.action_post only checks the Billing group, the same group that lets a user edit invoices. A user who may edit quotations may confirm them; a user with Billing rights may post invoices. Messages are similar: on contacts, sales orders and invoices, read access is enough to call message_post, and the same call that logs an internal note emails the customer when it uses the "comment" subtype or lists the customer as a recipient.

Is there an approval feature in standard Odoo?

Only for purchases. In Odoo 20 Community, Purchase's Purchase Order Approval setting puts orders above an amount in To Approve unless the user is a purchase manager, and it is checked on the server, so it also applies to API calls. Sales orders, invoices, contacts and other records have nothing similar.

The Approvals app of Odoo Enterprise handles requests that employees file, such as business trips, purchases, payments or borrowing items; it does not stop API calls. Odoo Studio (Enterprise) has approval rules that are set on buttons in the web client. Odoo's documentation describes them only for buttons and says nothing about API calls, so test one on your own database before relying on it.

Free ways to limit what an agent can change

  • Give the agent its own user. Create a user for the agent, give it only the apps it needs, and create the API key on that user. It cannot touch apps it has no rights on. It can still confirm and post wherever it may edit.
  • Ask for drafts in the prompt. Tell the agent to create quotations and draft invoices and never to confirm, post or send. This is an instruction, not a lock: a misunderstood request, a different tool or a prompt injection can still lead to a confirm call.
  • Read-only keys. If the agent only needs to answer questions, give it a key that cannot write at all (a module is needed for that in Odoo 20, see the FAQ).
  • Short-lived keys. Give each key an expiration date, so that a key you forgot stops working.

None of these lets the agent prepare a change and wait until someone has looked at it.

Hold the agent's changes until a person approves them

We made AI API Key Approval for this (GRAMSHIFT, Odoo 19 and 20). You set an approval rule on the API key you give the agent and choose what waits: creates, updates, deletes, and buttons such as confirm, post or send, on every model or only on the models you choose. Searching and reading are never held. It is listed for Odoo 20, Odoo 19.

When the agent sends a change, Odoo does not run it. The agent receives an error that says the call is held for approval, gives the request number and tells it not to send the call again. The call is kept as a request, exactly as sent. A person opens it in Odoo, sees what the call will do (for an update, the current values next to the requested ones), and clicks Approve and Run or Refuse. An approved call runs as the user of the key, not as the approver; if the record or the fields it would change were edited in the meantime, the request is closed as Refused: Records Changed and nothing runs. The agent cannot approve its own requests through the API, changes to users, rights, settings and modules always wait, whatever the rule names, and the key cannot create new API keys.

It works with JSON-2, XML-RPC and JSON-RPC, so with the MCP servers, n8n flows and scripts that use a standard Odoo API key. Give the agent an API key, not a password: logins with a password are not held. To hold emails too, leave the model list of the rule empty, or include the email composer and contacts. If you also want some keys to be read-only, or never to delete, AI API Key Permissions does that, and AI & API Audit Log keeps the previous values of what each key changed.

Frequently asked questions

Can I make AI agent changes in Odoo need approval?

Not with standard Odoo 20, except Purchase's order approval above an amount: an API call runs as soon as the key is checked. An approval module such as AI API Key Approval holds the changes made with a chosen API key (creates, updates, deletes, buttons such as confirm or post) until a person approves or refuses them in Odoo.

Can an AI agent confirm sales orders or post invoices in Odoo?

Yes, if its API key belongs to a user who may edit sales orders (to confirm them) or who has Billing rights (to post invoices). Odoo 20 asks for no further approval.

Does Odoo Studio approval stop API calls?

Studio approval rules (Odoo Enterprise) are set on buttons in the web client. Odoo's documentation describes them only for buttons and says nothing about API calls, so test one on your own database before relying on it.

How do I give ChatGPT or Claude read-only access to Odoo?

Odoo 20 API keys have no read-only option. Give the agent its own user with limited rights, or use a module such as AI API Key Permissions that makes a key read-only.

Is AI API Key Approval available for Odoo 19?

Yes. AI API Key Approval is listed separately for Odoo 20 and Odoo 19 on the Odoo Apps Store, with the same approval rules on API keys.

Related articles

Tech logRead-only Odoo API key for ChatGPT, Claude or an MCP server (Odoo 20)In Odoo 20 Community the only scope a new API key can get is RPC, and a key acts with every right of its user: on 2026-10-09 the same key that read orders also confirmed them through /json/2/sale.order/action_confirm. The free way to limit an AI agent is a dedicated user; where that stops, and why an ordinary update from an agent can remove order lines. Tech logWhen was an Odoo API key last used? Find unused keys and limit API calls (Odoo 20)An Odoo 20 API key stores its description, user, scope, creation date and expiration date, and nothing about its use. Latest Login on the user changes only for some clients, the server log does not name the key, and Odoo has no limit on calls per key. What each source shows, free ways to keep keys under control, and how to see the last call, IP address and daily calls of every key. Tech logHow to see what ChatGPT, Claude or an MCP server changed in Odoo (Odoo 20)Standard Odoo 20 keeps three traces of an API change: the Last Updated by field, chatter tracking on tracked fields, and one line per call in the server log. None of them names the API key, and deleting a record also deletes its chatter. What each trace shows, a free setup that makes them more useful, and how to keep the previous values of the changes an AI agent makes. Tech logSeparate inventory adjustment gains and losses in Odoo 19 and 20 (Stock Valuation Account Incoming and Outgoing are gone)Odoo 19 and 20 have one Loss Account on the Inventory adjustment location, so counts that find stock and counts that lose stock both post there and the profit and loss shows only the net. What changed from Odoo 18, the debit and credit of each case, the manual workaround, and a Gain Account next to the Loss Account. Tech logKPI dashboard for Odoo Community 20: shared dashboards from any list or pivot, where each user sees only their own numbersOn Odoo 20 Community you can view ready-made dashboards but not build your own or share one with your team. An add-on turns any list, pivot or graph into a number card or chart from the gear menu, and counts every card with the viewer's own access rights, so salespeople see only their own totals. Tech logAI assistant for Odoo Community: ask your Odoo data in plain English with your own OpenAI, Claude or Gemini key (Odoo 20)Odoo 20 Community has no AI assistant that answers questions about your records. To ask "What were confirmed sales per month this year?" inside Odoo, you need an add-on that uses your own OpenAI, Claude, Gemini or Ollama key. What to check first: read-only, the asking user's rights, no SQL, and answers you can open in Odoo.
All English articles