Odoo transaction boundaries
AI Integration with Odoo
Plan an Odoo AI integration around verified version and plan conditions, deployed models, restricted methods and real transaction boundaries.
Odoo AI integration needs a contract for the actual database, installed modules and permitted business methods. A generic connector can establish transport, but it cannot tell you whether a method changes a workflow state, creates related records or triggers communication. Those effects determine the scope and acceptance of an operational integration.
This guide uses the documented Odoo 19.0 external JSON-2 interface as a specific implementation reference. It does not assume that every existing Odoo deployment uses that version or exposes the same models. The intended reader is an Odoo owner or implementation lead connecting an external AI service to a controlled project or service workflow.
Verify version, hosting and API entitlement together
Record whether the estate is Odoo Online, Odoo.sh or another deployment, then identify the installed version, edition, modules and customisations. Check the current subscription and supported extension options. Odoo's 19.0 JSON-2 documentation identifies the interface as introduced in version 19 and describes a model-and-method endpoint. It also states external API plan restrictions for Odoo's pricing plans. Confirm the applicable commercial terms for the actual deployment rather than applying a hosted-plan statement indiscriminately to every installation.
For an existing integration, inventory the interface it already uses and its support lifecycle. Do not change transport solely because a newer example is easier to copy. Compare authentication, method semantics, errors and transaction behaviour, then plan any migration as a tested change. Deprecation schedules can change, so verify the current official notice at the time of migration instead of putting an unverified retirement date into a contract.
Distinguish external API work from features already delivered by installed Odoo applications. If a supported native operation meets the requirement, the AI service may only need to prepare a reviewed proposal. AI integration versus custom development helps identify when the missing capability requires application work rather than another connector.
Discover the database's real model contract
Inspect the deployed model and method documentation with the application owner. Identify record IDs, field types, relationships, required values and the business methods intended for the workflow. Custom modules can change the available surface, so a model name copied from another company is not reliable evidence. Store the accepted contract alongside the specific module and configuration versions.
The external AI tool should expose a narrow business action, such as proposing a service-job review outcome. It should not give the model unrestricted ability to choose any Odoo model and method. The adapter maps the approved action to the supported method, supplies trusted record identifiers and rejects unexpected parameters. A request that is technically callable may still be outside the agreed business purpose.
Keep language separate from identity. An Arabic stage label can be shown to a reviewer, but execution should use the configured record or selection value. If two projects use similarly named stages with different meanings, the contract must distinguish them. Do not let the model infer a universal workflow from translated display text.
Understand the transaction boundary before combining calls
Odoo documents that each JSON-2 call runs in its own SQL transaction; separate calls cannot be combined into one transaction merely by sending them consecutively. Its JSON-2 transaction guidance recommends a single method for related operations that need one transactional boundary. A supported existing business method may provide that boundary; otherwise an appropriate reviewed module may be required where the deployment permits it.
This matters even when the AI's interpretation is correct. If the integration performs three independent calls and the third fails, the first two may already have committed. Calling the sequence a “workflow” does not create atomicity. Nor does a local Odoo transaction automatically include an email provider, document store or another external system.
Separate the desired business invariant from the transport sequence. An invariant might be “the service job must not enter review-ready state without its mandatory review record”. The application team should decide which supported operation enforces that invariant and how external side effects are coordinated. Integration architecture patterns provides the broader transaction and orchestration choices.
Worked example: a service job reaches the next stage without its review record
Consider an illustrative company using a customised Odoo service workflow. An AI assistant reads a technician's authorised notes and drafts a review summary. A supervisor approves it. The proposed integration first changes the job stage, then creates a related review record containing the approved summary. These are hypothetical business operations, not claims that every Odoo database has those models.
The stage change succeeds. The second call fails because the custom review record requires a field omitted by the integration. The job now appears ready for review while the expected evidence is absent. Retrying both calls can repeat automation associated with the stage transition, while retrying only the second call without checking the current record can attach evidence to a changed context.
One possible design is a restricted server-side business method that validates the approved input and performs the linked Odoo changes in one transaction, if supported and permitted in that deployment. Another is an explicitly staged process in which the job remains pending until the review record is confirmed. Choose based on the business invariant and platform constraints, then test the chosen recovery behaviour.
Any external notification remains a separate concern. If the operation later notifies a customer or an engineer, identify when that message is allowed, how it is deduplicated and how its outcome is recorded. The existence of an Odoo record does not prove that a recipient received a message.
Use a transaction-boundary worksheet
| Question | Decision to document | Failure test |
|---|---|---|
| What must remain consistent? | Review-ready state requires an accepted review record. | Reject missing mandatory review data. |
| What runs in one Odoo transaction? | The selected supported business method and its internal changes. | Force a validation error and inspect all affected records. |
| What crosses a separate boundary? | Notifications and other external operations. | Make the external service unavailable after local success. |
| What identifies a repeated request? | A durable application-level operation reference and lookup rule. | Repeat an accepted request and verify the intended behaviour. |
| What happens after a lost response? | Reconciliation before a consequential retry. | Hide the response while preserving the destination result. |
| Who can repair an exception? | A named role with a bounded repair method. | Attempt repair without the required authority. |
The worksheet makes a vendor demonstration more informative. Ask the team to show the missing-field failure and the resulting records, not only the successful path. If the proposed solution relies on a custom module, include its source ownership, upgrade compatibility and support responsibility in the delivery scope.
Restrict the bot identity and company context
Use a dedicated integration identity with the required access rights, record rules and field permissions. Odoo's JSON-2 security documentation describes enforcement through its standard model security and recommends a dedicated bot user for automated integrations. Validate the actual configuration with allowed and denied records; a technically valid API key is not evidence that the identity is appropriately constrained.
Multi-company environments need explicit attention. Record the company context that applies to each operation and test that a request cannot reach another company's records through a broad service identity or an ambiguous lookup. Company access, document ownership and allowed methods must agree. Access-control design provides a useful way to express these relationships before implementation.
Keep API keys outside prompts and ordinary logs. Plan rotation and revocation, and prove that a disabled integration identity cannot continue through a cached credential path. If the application returns diagnostic details, sanitise what reaches the requester while preserving restricted technical evidence for authorised support staff.
Accept the workflow against the deployed modules
Test with a representative module set and safe data. Include Arabic notes, mixed-language labels, missing mandatory fields, incompatible record state, another company's record and repeated requests. Test the result after a module update, since method behaviour and required fields may change even when the integration's URL stays the same.
Use integration testing to separate interpretation quality from transaction correctness. An accurate summary can still be attached to the wrong job. A correct local transaction can still leave a failed external notification. Keep those acceptance outcomes separate so that operators know what requires repair.
Audit logging should link the source notes, approved summary reference, selected method, operation reference and destination result without routinely duplicating full technician notes. For context on coordinating systems and people, Trusted Data's workflow automation guide is related commercial reading; the Odoo contract should remain specific to your modules and deployment.
To discuss AI integration and delivery with OpenForAI, bring the Odoo version and hosting arrangement, installed modules, one masked workflow example and the consistency rule that must hold. Enquire about an Odoo AI integration project with those details so that API feasibility, transactional behaviour and support ownership can be agreed before implementation.
FAQ
Your questions, answered.
Is JSON-2 available in every Odoo version?
This guide refers specifically to the JSON-2 interface documented for Odoo 19.0. Verify the installed version and its supported interfaces before using the design. Existing deployments may use other APIs with different request and error behaviour. Migration should include authentication, business-method and transaction tests rather than just replacing endpoint URLs.
Does Odoo Standard include external API access?
Odoo’s current documentation states that external API access is available on Custom pricing plans and not on One App Free or Standard. Confirm the applicable subscription and deployment with the provider before committing scope. Do not generalise that commercial statement into an unsupported claim about every self-managed installation, edition or custom hosting arrangement.
Can several Odoo JSON-2 calls form one transaction?
The documented interface treats each call as its own transaction. Consecutive calls do not become atomic as a group. Where related Odoo changes must succeed together, assess a supported business method that performs them together or an appropriate reviewed module where permitted. External services remain separate transaction boundaries and still need coordination and recovery.
Should an AI agent call arbitrary Odoo model methods?
A production tool should expose only the agreed business operations and parameters. Let a controlled adapter map those operations to supported methods and trusted record identifiers. Restrict the bot identity, validate company context and reject unexpected fields. Broad method access makes it harder to prove that the agent cannot bypass the approved process.
How do we handle custom Odoo modules in an AI integration?
Treat their deployed models, fields, methods and side effects as part of the integration contract. Confirm support and extension options for the hosting arrangement, then test with the same relevant module set as production. Include source ownership, upgrade review and maintenance responsibility in scope. A generic Odoo connector does not guarantee compatibility with bespoke behaviour.
What should happen when an Odoo write succeeds but its notification fails?
Keep the local business result and external notification result distinct. Determine whether the notification can be retried safely using an operation reference and duplicate protection. Do not repeat the business transaction merely to resend a message. Provide an exception route when the outcome is uncertain, and show operators which part completed and which still needs attention.