Initial commit: OCA Ai packages (4 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:05 +02:00
commit 0adb4b78b1
170 changed files with 12385 additions and 0 deletions

View file

@ -0,0 +1,45 @@
# Ai Oca Bridge Document Page
Odoo addon: ai_oca_bridge_document_page
## Installation
```bash
pip install odoo-bringout-oca-ai-ai_oca_bridge_document_page
```
## Dependencies
This addon depends on:
- ai_oca_bridge
- document_page
## Manifest Information
- **Name**: Ai Oca Bridge Document Page
- **Version**: 16.0.1.0.0
- **Category**: N/A
- **License**: AGPL-3
- **Installable**: False
## Source
Based on [OCA/ai](https://github.com/OCA/ai) branch 16.0, addon `ai_oca_bridge_document_page`.
## License
This package maintains the original AGPL-3 license from the upstream Odoo project.
## Documentation
- Overview: doc/OVERVIEW.md
- Architecture: doc/ARCHITECTURE.md
- Models: doc/MODELS.md
- Controllers: doc/CONTROLLERS.md
- Wizards: doc/WIZARDS.md
- Install: doc/INSTALL.md
- Usage: doc/USAGE.md
- Configuration: doc/CONFIGURATION.md
- Dependencies: doc/DEPENDENCIES.md
- Troubleshooting: doc/TROUBLESHOOTING.md
- FAQ: doc/FAQ.md

View file

@ -0,0 +1,137 @@
===========================
Ai Oca Bridge Document Page
===========================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1f586a1e2acb67018aa9d963faad585dc1c5d27885f860fdbaf6b7f11565e105
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fai-lightgray.png?logo=github
:target: https://github.com/OCA/ai/tree/16.0/ai_oca_bridge_document_page
:alt: OCA/ai
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/ai-16-0/ai-16-0-ai_oca_bridge_document_page
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/ai&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module is intended for allowing users to use OCA's Knowledge app
for as a source of knowledge for AI Agents, although this is not the
only usage this module could have
**Table of contents**
.. contents::
:local:
Configuration
=============
Configuration Guide
-------------------
To use this module as intended, two components must be configured:
1. **Bridge configuration on the Odoo side**
2. **An endpoint capable of handling bridge requests**
For an agent to have updated RAG (Retrieval-Augmented Generation)
capabilities, you must create at least **three bridges** for each active
knowledge database:
- | **Bridge with ``Usage = "AI Thread Create"``**
| Adds document pages to the external database used by agents.
- | **Bridge with ``Usage = "AI Thread Write"``**
| Updates document pages already on the external database used by
agents.
- | **Bridge with ``Usage = "AI Thread Unlink"``**
| Removes document pages from the external database when those pages
are deleted from Odoo.
For creating those bridges, apart from the usage of the bridge, the user
must define:
- Payload Type: it depends on the endpoint configuration, normally
"Record" would work.
- Result Type: for this case "No processing" is OK.
- Model: select the "Document Page" model
- Field: add at least the fields the endpoint is expecting on the other
side.
- Filter: add a domain for using the bridge only with the documents
intended to trigger bridge
For context, you can download an `example n8n workflow JSON
file <../static/description/RagCapabilitiesWithOdooKnowledge.json>`__
capable of handling the bridge with ``Usage = "AI Thread Create"``. This
workflow includes a manual trigger for testing purposes. Remember to
update the models and database knowledge as needed.
Usage
=====
Depending on the bridges you have created, create, update or delete a
Document Page mathing the bridge domain. You should see the execution on
the AI Bridge Execution menu.
For testing the endpoint side, you can download `this n8n workflow
JSON <../static/description/RagCapabilitiesWithOdooKnowledge.json>`__,
capable of inserting information on the database. Keep in mind that for
this to work at least ``content``, ``display_name`` and ``draft_name``
fields should be included on the list of fields
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/ai/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/ai/issues/new?body=module:%20ai_oca_bridge_document_page%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
-------
* Binhex
Contributors
------------
- `Binhex <https://www.binhex.cloud/>`__
- Ariel Barreiros
Maintainers
-----------
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/ai <https://github.com/OCA/ai/tree/16.0/ai_oca_bridge_document_page>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View file

@ -0,0 +1 @@
from . import models

View file

@ -0,0 +1,19 @@
# Copyright 2025 Binhex
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Ai Oca Bridge Document Page",
"summary": """Adds Documents synchronization using AI Bridges""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Binhex,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/ai",
"depends": [
"ai_oca_bridge",
"document_page",
],
"data": [],
"demo": [
"demo/ai_bridge_demo.xml",
],
}

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="ai_bridge_document_page_create" model="ai.bridge">
<field name="name">Document Page AI Bridge - Create</field>
<field name="description">
<![CDATA[
<p>This AI bridge is triggered when a new document page is created.</p>
]]>
</field>
<field name="model_id" ref="document_page.model_document_page" />
<field name="usage">ai_thread_create</field>
<field name="url">https://api.example.com/ai/document/create</field>
<field name="auth_type">none</field>
<field name="payload_type">record</field>
<field name="result_type">none</field>
<field name="result_kind">immediate</field>
<field
name="field_ids"
eval="[(6, 0, [ref('document_page.field_document_page__content'), ref('document_page.field_document_page__display_name'), ref('document_page.field_document_page__draft_name')])]"
/>
</record>
<record id="ai_bridge_document_page_write" model="ai.bridge">
<field name="name">Document Page AI Bridge - Update</field>
<field name="description">
<![CDATA[
<p>This AI bridge is triggered when a document page is updated.</p>
]]>
</field>
<field name="model_id" ref="document_page.model_document_page" />
<field name="usage">ai_thread_write</field>
<field name="url">https://api.example.com/ai/document/create</field>
<field name="auth_type">none</field>
<field name="payload_type">record</field>
<field name="result_type">none</field>
<field name="result_kind">immediate</field>
<field
name="field_ids"
eval="[(6, 0, [ref('document_page.field_document_page__content'), ref('document_page.field_document_page__display_name'), ref('document_page.field_document_page__draft_name')])]"
/>
</record>
<record id="ai_bridge_document_page_unlink" model="ai.bridge">
<field name="name">Document Page AI Bridge - Delete</field>
<field name="description">
<![CDATA[
<p>This AI bridge is triggered when a document page is deleted.</p>
]]>
</field>
<field name="model_id" ref="document_page.model_document_page" />
<field name="usage">ai_thread_unlink</field>
<field name="url">https://api.example.com/ai/document/create</field>
<field name="auth_type">none</field>
<field name="payload_type">none</field>
<field name="result_type">none</field>
<field name="result_kind">immediate</field>
</record>
</odoo>

View file

@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ai_oca_bridge_document_page
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: ai_oca_bridge_document_page
#: model:ir.model,name:ai_oca_bridge_document_page.model_document_page
msgid "Document Page"
msgstr ""
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "Document Page AI Bridge - Create"
msgstr ""
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "Document Page AI Bridge - Delete"
msgstr ""
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "Document Page AI Bridge - Update"
msgstr ""
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "This AI bridge is triggered when a document page is deleted."
msgstr ""
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "This AI bridge is triggered when a document page is updated."
msgstr ""
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "This AI bridge is triggered when a new document page is created."
msgstr ""

View file

@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ai_oca_bridge_document_page
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: ai_oca_bridge_document_page
#: model:ir.model,name:ai_oca_bridge_document_page.model_document_page
msgid "Document Page"
msgstr "Stranica dokumenta"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "Document Page AI Bridge - Create"
msgstr "AI most stranice dokumenta - Kreiranje"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "Document Page AI Bridge - Delete"
msgstr "AI most stranice dokumenta - Brisanje"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "Document Page AI Bridge - Update"
msgstr "AI most stranice dokumenta - Ažuriranje"
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "This AI bridge is triggered when a document page is deleted."
msgstr "Ovaj AI most se pokreće kada se obriše stranica dokumenta."
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "This AI bridge is triggered when a document page is updated."
msgstr "Ovaj AI most se pokreće kada se ažurira stranica dokumenta."
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "This AI bridge is triggered when a new document page is created."
msgstr "Ovaj AI most se pokreće kada se kreira nova stranica dokumenta."

View file

@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ai_oca_bridge_document_page
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-08-15 22:40+0000\n"
"Last-Translator: \"Leonardo J. Caballero G.\" <leonardocaballero@gmail.com>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"
#. module: ai_oca_bridge_document_page
#: model:ir.model,name:ai_oca_bridge_document_page.model_document_page
msgid "Document Page"
msgstr "Página del documento"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "Document Page AI Bridge - Create"
msgstr "Puente de IA de la página del documento - Crear"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "Document Page AI Bridge - Delete"
msgstr "Puente de IA de la página del documento - Eliminar"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "Document Page AI Bridge - Update"
msgstr "Puente de IA de la página del documento - Actualizar"
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "This AI bridge is triggered when a document page is deleted."
msgstr "Este puente AI se activa cuando se elimina una página del documento."
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "This AI bridge is triggered when a document page is updated."
msgstr "Este puente AI se activa cuando se actualiza una página de documento."
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "This AI bridge is triggered when a new document page is created."
msgstr ""
"Este puente de IA se activa cuando se crea una nueva página de documento."

View file

@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ai_oca_bridge_document_page
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-08-16 01:25+0000\n"
"Last-Translator: \"Leonardo J. Caballero G.\" <leonardocaballero@gmail.com>\n"
"Language-Team: none\n"
"Language: es_VE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"
#. module: ai_oca_bridge_document_page
#: model:ir.model,name:ai_oca_bridge_document_page.model_document_page
msgid "Document Page"
msgstr "Página del documento"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "Document Page AI Bridge - Create"
msgstr "Puente de IA de la página del documento - Crear"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "Document Page AI Bridge - Delete"
msgstr "Puente de IA de la página del documento - Eliminar"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "Document Page AI Bridge - Update"
msgstr "Puente de IA de la página del documento - Actualizar"
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "This AI bridge is triggered when a document page is deleted."
msgstr "Este puente AI se activa cuando se elimina una página del documento."
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "This AI bridge is triggered when a document page is updated."
msgstr "Este puente AI se activa cuando se actualiza una página de documento."
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "This AI bridge is triggered when a new document page is created."
msgstr ""
"Este puente de IA se activa cuando se crea una nueva página de documento."

View file

@ -0,0 +1,52 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ai_oca_bridge_document_page
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-07-31 10:59+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"
#. module: ai_oca_bridge_document_page
#: model:ir.model,name:ai_oca_bridge_document_page.model_document_page
msgid "Document Page"
msgstr "Pagina documento"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "Document Page AI Bridge - Create"
msgstr "Collegamento IA pagina documento - Crea"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "Document Page AI Bridge - Delete"
msgstr "Collegamento IA pagina documento - Cancella"
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "Document Page AI Bridge - Update"
msgstr "Collegamento IA pagina documento - Aggiorna"
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "This AI bridge is triggered when a document page is deleted."
msgstr "Il collegamento IA è attivato quando una pagina documento è cancellata."
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "This AI bridge is triggered when a document page is updated."
msgstr "Il collegamento IA è attivato quando una pagina documento è aggiornata."
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "This AI bridge is triggered when a new document page is created."
msgstr "Il collegamento IA è attivato quando una pagina documento è creata."

View file

@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ai_oca_bridge_document_page
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
#. module: ai_oca_bridge_document_page
#: model:ir.model,name:ai_oca_bridge_document_page.model_document_page
msgid "Document Page"
msgstr ""
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "Document Page AI Bridge - Create"
msgstr ""
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "Document Page AI Bridge - Delete"
msgstr ""
#. module: ai_oca_bridge_document_page
#: model:ai.bridge,name:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "Document Page AI Bridge - Update"
msgstr ""
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_unlink
msgid "This AI bridge is triggered when a document page is deleted."
msgstr ""
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_write
msgid "This AI bridge is triggered when a document page is updated."
msgstr ""
#. module: ai_oca_bridge_document_page
#: model_terms:ai.bridge,description:ai_oca_bridge_document_page.ai_bridge_document_page_create
msgid "This AI bridge is triggered when a new document page is created."
msgstr ""

View file

@ -0,0 +1 @@
from . import document_page

View file

@ -0,0 +1,6 @@
from odoo import models
class DocumentPage(models.Model):
_inherit = ["document.page", "ai.bridge.thread"]
_name = "document.page"

View file

@ -0,0 +1,26 @@
## Configuration Guide
To use this module as intended, two components must be configured:
1. **Bridge configuration on the Odoo side**
2. **An endpoint capable of handling bridge requests**
For an agent to have updated RAG (Retrieval-Augmented Generation) capabilities, you must create at least **three bridges** for each active knowledge database:
- **Bridge with `Usage = "AI Thread Create"`**
Adds document pages to the external database used by agents.
- **Bridge with `Usage = "AI Thread Write"`**
Updates document pages already on the external database used by agents.
- **Bridge with `Usage = "AI Thread Unlink"`**
Removes document pages from the external database when those pages are deleted from Odoo.
For creating those bridges, apart from the usage of the bridge, the user must define:
- Payload Type: it depends on the endpoint configuration, normally "Record" would work.
- Result Type: for this case "No processing" is OK.
- Model: select the "Document Page" model
- Field: add at least the fields the endpoint is expecting on the other side.
- Filter: add a domain for using the bridge only with the documents intended to trigger bridge
For context, you can download an [example n8n workflow JSON file](../static/description/RagCapabilitiesWithOdooKnowledge.json) capable of handling the bridge with `Usage = "AI Thread Create"`. This workflow includes a manual trigger for testing purposes. Remember to update the models and database knowledge as needed.

View file

@ -0,0 +1,3 @@
- [Binhex](https://www.binhex.cloud/)
- Ariel Barreiros

View file

@ -0,0 +1,3 @@
This module is intended for allowing users to use OCA's Knowledge app for as
a source of knowledge for AI Agents, although this is not the only usage this module
could have

View file

@ -0,0 +1,3 @@
Depending on the bridges you have created, create, update or delete a Document Page mathing the bridge domain. You should see the execution on the AI Bridge Execution menu.
For testing the endpoint side, you can download [this n8n workflow JSON](../static/description/RagCapabilitiesWithOdooKnowledge.json), capable of inserting information on the database. Keep in mind that for this to work at least `content`, `display_name` and `draft_name` fields should be included on the list of fields

View file

@ -0,0 +1,317 @@
{
"name": "RagCapabilitiesWithOdooKnowledge",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "eb45cee2-0176-43e8-9594-72d681802926",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [-20, -60],
"name": "Webhook",
"id": "ee52dae6-e719-41c1-a5b1-a5311a21bdb0",
"webhookId": "eb45cee2-0176-43e8-9594-72d681802926"
},
{
"parameters": {
"html": "={{ $json.body.record.content }}",
"options": {}
},
"type": "n8n-nodes-base.markdown",
"typeVersion": 1,
"position": [220, -60],
"id": "a004b925-2461-4574-944b-e5a1eeeed0a7",
"name": "Markdown"
},
{
"parameters": {
"mode": "insert",
"memoryKey": {
"__rl": true,
"mode": "list",
"value": "vector_store_key"
},
"embeddingBatchSize": 1
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"typeVersion": 1.3,
"position": [720, -60],
"id": "662d1025-0b0f-48d7-a568-764cee7116c9",
"name": "Simple Vector Store"
},
{
"parameters": {
"jsonMode": "expressionData",
"jsonData": "={{ $('PrepareContent').item.json.document_content }}",
"options": {
"metadata": {
"metadataValues": [
{
"name": "document_id",
"value": "document_title"
},
{
"name": "document_revision"
}
]
}
}
},
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"typeVersion": 1.1,
"position": [880, 160],
"id": "a1fa398a-b67f-4ba8-8756-ced0caa26e2f",
"name": "Default Data Loader"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.query }}",
"options": {
"systemMessage": "=You are a RAG-only assistant.\n\nYour ONLY job is to answer questions using the external TOOL provided. DO NOT use your own knowledge or memory. You are NOT allowed to explain or judge the tool's answer.\n\nRules:\n1. ALWAYS call the TOOL for EVERY question.\n2. DO NOT add, change, or \"fix\" the TOOL's response.\n3. Prepare the final response using only the information from the TOOLs response.\n\nEven if the TOOL says something strange, funny, or wrong — TRUST it completely. That is your only task."
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2,
"position": [260, 340],
"id": "08efea5a-4778-4bfc-a942-88726e378b89",
"name": "AI Agent"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "a9a3c583-0238-407a-a100-7e4c5685fb7c",
"name": "document_content",
"value": "={{ $json.data }}",
"type": "string"
},
{
"id": "2067d6cf-6822-4089-b424-7bcc44e974b9",
"name": "document_id",
"value": "={{ $json.body.record.id }}",
"type": "string"
},
{
"id": "2bfe6080-164b-499e-9d4a-bb47bbe675ac",
"name": "document_title",
"value": "={{ $json.body.record.display_name }}",
"type": "string"
},
{
"id": "b796a424-5757-4d6f-9cfd-e959fd1a4d52",
"name": "document_revision",
"value": "={{ $json.body.record.draft_name }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [480, -60],
"id": "76eb1632-202d-4c3f-b8bc-ef11269f924f",
"name": "PrepareContent"
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "Call this tool for getting answers to any kind of human questions",
"memoryKey": {
"__rl": true,
"mode": "list",
"value": "vector_store_key"
},
"topK": 2,
"includeDocumentMetadata": false
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"typeVersion": 1.3,
"position": [460, 580],
"id": "233c6570-03fe-4d9a-96b9-c8ef6d48aea4",
"name": "Simple Vector Store Tool"
},
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [-20, 340],
"id": "3132b80b-3490-4663-abee-d319d4df6a82",
"name": "TestRAG"
},
{
"parameters": {
"model": "granite-embedding:latest"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [700, 160],
"id": "16f298b4-cff0-44d8-97fe-0ec2ffa39aac",
"name": "GraniteEmbedding",
"credentials": {
"ollamaApi": {
"id": "swl1IV4BEvffsY2Q",
"name": "Ollama account"
}
}
},
{
"parameters": {
"model": "granite-embedding:latest"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [440, 780],
"id": "d16c9eb5-dfa5-42c0-9a41-8e079a496603",
"name": "GraniteEmbeddingRecover",
"credentials": {
"ollamaApi": {
"id": "swl1IV4BEvffsY2Q",
"name": "Ollama account"
}
}
},
{
"parameters": {
"model": "qwen3:1.7b",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
"typeVersion": 1,
"position": [240, 580],
"id": "0bdb0f17-a0a4-48f4-8db7-73fe1dbc85cf",
"name": "Qwen3:1.7b",
"credentials": {
"ollamaApi": {
"id": "swl1IV4BEvffsY2Q",
"name": "Ollama account"
}
}
}
],
"pinData": {
"TestRAG": [
{
"json": {
"query": "Why do apples fall to the ground?"
}
}
]
},
"connections": {
"Webhook": {
"main": [
[
{
"node": "Markdown",
"type": "main",
"index": 0
}
]
]
},
"Markdown": {
"main": [
[
{
"node": "PrepareContent",
"type": "main",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Simple Vector Store",
"type": "ai_document",
"index": 0
}
]
]
},
"PrepareContent": {
"main": [
[
{
"node": "Simple Vector Store",
"type": "main",
"index": 0
}
]
]
},
"Simple Vector Store Tool": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"TestRAG": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"GraniteEmbedding": {
"ai_embedding": [
[
{
"node": "Simple Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"GraniteEmbeddingRecover": {
"ai_embedding": [
[
{
"node": "Simple Vector Store Tool",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Qwen3:1.7b": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "99787de6-2e75-4ea8-9df7-18cf24486187",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "9dfb7cea57c92e029bf10b0f55a26934d6922e8cd8a7e993b1dde4590d0674ca"
},
"id": "S9hHrLjEISoxhrCm",
"tags": []
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View file

@ -0,0 +1,494 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Ai Oca Bridge Document Page</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="ai-oca-bridge-document-page">
<h1 class="title">Ai Oca Bridge Document Page</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1f586a1e2acb67018aa9d963faad585dc1c5d27885f860fdbaf6b7f11565e105
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/ai/tree/16.0/ai_oca_bridge_document_page"><img alt="OCA/ai" src="https://img.shields.io/badge/github-OCA%2Fai-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/ai-16-0/ai-16-0-ai_oca_bridge_document_page"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/ai&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module is intended for allowing users to use OCAs Knowledge app
for as a source of knowledge for AI Agents, although this is not the
only usage this module could have</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a><ul>
<li><a class="reference internal" href="#configuration-guide" id="toc-entry-2">Configuration Guide</a></li>
</ul>
</li>
<li><a class="reference internal" href="#usage" id="toc-entry-3">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-4">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-5">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-6">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-7">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<div class="section" id="configuration-guide">
<h2><a class="toc-backref" href="#toc-entry-2">Configuration Guide</a></h2>
<p>To use this module as intended, two components must be configured:</p>
<ol class="arabic simple">
<li><strong>Bridge configuration on the Odoo side</strong></li>
<li><strong>An endpoint capable of handling bridge requests</strong></li>
</ol>
<p>For an agent to have updated RAG (Retrieval-Augmented Generation)
capabilities, you must create at least <strong>three bridges</strong> for each active
knowledge database:</p>
<ul>
<li><div class="first line-block">
<div class="line"><strong>Bridge with ``Usage = “AI Thread Create”``</strong></div>
<div class="line">Adds document pages to the external database used by agents.</div>
</div>
</li>
<li><div class="first line-block">
<div class="line"><strong>Bridge with ``Usage = “AI Thread Write”``</strong></div>
<div class="line">Updates document pages already on the external database used by
agents.</div>
</div>
</li>
<li><div class="first line-block">
<div class="line"><strong>Bridge with ``Usage = “AI Thread Unlink”``</strong></div>
<div class="line">Removes document pages from the external database when those pages
are deleted from Odoo.</div>
</div>
</li>
</ul>
<p>For creating those bridges, apart from the usage of the bridge, the user
must define:</p>
<ul class="simple">
<li>Payload Type: it depends on the endpoint configuration, normally
“Record” would work.</li>
<li>Result Type: for this case “No processing” is OK.</li>
<li>Model: select the “Document Page” model</li>
<li>Field: add at least the fields the endpoint is expecting on the other
side.</li>
<li>Filter: add a domain for using the bridge only with the documents
intended to trigger bridge</li>
</ul>
<p>For context, you can download an <a class="reference external" href="../static/description/RagCapabilitiesWithOdooKnowledge.json">example n8n workflow JSON
file</a>
capable of handling the bridge with <tt class="docutils literal">Usage = &quot;AI Thread Create&quot;</tt>. This
workflow includes a manual trigger for testing purposes. Remember to
update the models and database knowledge as needed.</p>
</div>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
<p>Depending on the bridges you have created, create, update or delete a
Document Page mathing the bridge domain. You should see the execution on
the AI Bridge Execution menu.</p>
<p>For testing the endpoint side, you can download <a class="reference external" href="../static/description/RagCapabilitiesWithOdooKnowledge.json">this n8n workflow
JSON</a>,
capable of inserting information on the database. Keep in mind that for
this to work at least <tt class="docutils literal">content</tt>, <tt class="docutils literal">display_name</tt> and <tt class="docutils literal">draft_name</tt>
fields should be included on the list of fields</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/ai/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/ai/issues/new?body=module:%20ai_oca_bridge_document_page%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
<ul class="simple">
<li>Binhex</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.binhex.cloud/">Binhex</a><ul>
<li>Ariel Barreiros</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/ai/tree/16.0/ai_oca_bridge_document_page">OCA/ai</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,4 @@
# Copyright 2025 Binhex
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_document_page_ai_bridge

View file

@ -0,0 +1,230 @@
# Copyright 2025 Binhex
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from unittest import mock
from odoo.tests.common import TransactionCase
class TestDocumentPageAiBridge(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.bridge_create = cls.env["ai.bridge"].create(
{
"name": "Document Page AI Bridge - Create",
"description": "<p>Test bridge for document page creation</p>",
"model_id": cls.env.ref("document_page.model_document_page").id,
"usage": "ai_thread_create",
"url": "https://api.example.com/ai/document/create",
"auth_type": "none",
"payload_type": "record",
"result_type": "none",
"result_kind": "immediate",
"field_ids": [
(
6,
0,
[
cls.env.ref(
"document_page.field_document_page__content"
).id,
cls.env.ref(
"document_page.field_document_page__display_name"
).id,
cls.env.ref(
"document_page.field_document_page__draft_name"
).id,
],
)
],
}
)
cls.bridge_write = cls.env["ai.bridge"].create(
{
"name": "Document Page AI Bridge - Update",
"description": "<p>Test bridge for document page updates</p>",
"model_id": cls.env.ref("document_page.model_document_page").id,
"usage": "ai_thread_write",
"url": "https://api.example.com/ai/document/update",
"auth_type": "none",
"payload_type": "record",
"result_type": "none",
"result_kind": "immediate",
"field_ids": [
(
6,
0,
[
cls.env.ref(
"document_page.field_document_page__content"
).id,
cls.env.ref(
"document_page.field_document_page__display_name"
).id,
cls.env.ref(
"document_page.field_document_page__draft_name"
).id,
],
)
],
}
)
cls.bridge_unlink = cls.env["ai.bridge"].create(
{
"name": "Document Page AI Bridge - Delete",
"description": "<p>Test bridge for document page deletion</p>",
"model_id": cls.env.ref("document_page.model_document_page").id,
"usage": "ai_thread_unlink",
"url": "https://api.example.com/ai/document/delete",
"auth_type": "none",
"payload_type": "none",
"result_type": "none",
"result_kind": "immediate",
}
)
def test_document_page_create_bridge(self):
with mock.patch("requests.post") as mock_post:
mock_post.return_value.status_code = 200
mock_post.return_value.json.return_value = {"message": "Document created"}
self.assertEqual(
0,
self.env["ai.bridge.execution"].search_count(
[("ai_bridge_id", "=", self.bridge_create.id)]
),
)
document_page = self.env["document.page"].create(
{
"name": "Test Document Page",
"content": "<p>This is a test document page for AI bridge</p>",
}
)
executions = self.env["ai.bridge.execution"].search(
[("ai_bridge_id", "=", self.bridge_create.id)]
)
self.assertEqual(len(executions), 1)
args, kwargs = mock_post.call_args
self.assertEqual(args[0], "https://api.example.com/ai/document/create")
record = kwargs["json"].get("record", {})
self.assertEqual(record.get("id"), document_page.id)
self.assertEqual(record.get("display_name"), "Test Document Page")
self.assertIn("This is a test document page", record.get("content", ""))
def test_document_page_write_bridge(self):
self.bridge_create.active = False
document_page = self.env["document.page"].create(
{
"name": "Test Document Page for Update",
"content": "<p>Initial content</p>",
}
)
self.bridge_create.active = True
with mock.patch("requests.post") as mock_post:
mock_post.return_value.status_code = 200
mock_post.return_value.json.return_value = {"message": "Document updated"}
self.assertEqual(
0,
self.env["ai.bridge.execution"].search_count(
[("ai_bridge_id", "=", self.bridge_write.id)]
),
)
document_page.write(
{
"name": "Updated Document Page",
"content": "<p>Updated content for AI bridge test</p>",
}
)
executions = self.env["ai.bridge.execution"].search(
[("ai_bridge_id", "=", self.bridge_write.id)]
)
self.assertEqual(len(executions), 1)
args, kwargs = mock_post.call_args
self.assertEqual(args[0], "https://api.example.com/ai/document/update")
record = kwargs["json"].get("record", {})
self.assertEqual(record.get("id"), document_page.id)
self.assertEqual(record.get("display_name"), "Updated Document Page")
self.assertIn(
"Updated content for AI bridge test", record.get("content", "")
)
def test_document_page_unlink_bridge(self):
self.bridge_create.active = False
document_page = self.env["document.page"].create(
{
"name": "Test Document Page for Deletion",
"content": "<p>Content to be deleted</p>",
}
)
self.bridge_create.active = True
document_id = document_page.id
with mock.patch("requests.post") as mock_post:
mock_post.return_value.status_code = 200
mock_post.return_value.json.return_value = {"message": "Document deleted"}
self.assertEqual(
0,
self.env["ai.bridge.execution"].search_count(
[("ai_bridge_id", "=", self.bridge_unlink.id)]
),
)
document_page.unlink()
executions = self.env["ai.bridge.execution"].search(
[("ai_bridge_id", "=", self.bridge_unlink.id)]
)
self.assertEqual(len(executions), 1)
args, kwargs = mock_post.call_args
self.assertEqual(args[0], "https://api.example.com/ai/document/delete")
self.assertEqual(kwargs["json"].get("_id", False), document_id)
def test_all_bridges_together(self):
with mock.patch("requests.post") as mock_post:
mock_post.return_value.status_code = 200
mock_post.return_value.json.return_value = {"message": "Success"}
self.assertEqual(
0,
self.env["ai.bridge.execution"].search_count(
[("ai_bridge_id", "=", self.bridge_create.id)]
),
)
self.assertEqual(
0,
self.env["ai.bridge.execution"].search_count(
[("ai_bridge_id", "=", self.bridge_write.id)]
),
)
self.assertEqual(
0,
self.env["ai.bridge.execution"].search_count(
[("ai_bridge_id", "=", self.bridge_unlink.id)]
),
)
document_page = self.env["document.page"].create(
{
"name": "Complete Test Document",
"content": "<p>Initial content for complete test</p>",
}
)
document_page.write({"content": "<p>Updated content for complete test</p>"})
document_page.unlink()
self.assertEqual(
1,
self.env["ai.bridge.execution"].search_count(
[("ai_bridge_id", "=", self.bridge_create.id)]
),
)
self.assertEqual(
1,
self.env["ai.bridge.execution"].search_count(
[("ai_bridge_id", "=", self.bridge_write.id)]
),
)
self.assertEqual(
1,
self.env["ai.bridge.execution"].search_count(
[("ai_bridge_id", "=", self.bridge_unlink.id)]
),
)

View file

@ -0,0 +1,32 @@
# Architecture
```mermaid
flowchart TD
U[Users] -->|HTTP| V[Views and QWeb Templates]
V --> C[Controllers]
V --> W[Wizards Transient Models]
C --> M[Models and ORM]
W --> M
M --> R[Reports]
DX[Data XML] --> M
S[Security ACLs and Groups] -. enforces .-> M
subgraph Ai_oca_bridge_document_page Module - ai_oca_bridge_document_page
direction LR
M:::layer
W:::layer
C:::layer
V:::layer
R:::layer
S:::layer
DX:::layer
end
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
```
Notes
- Views include tree/form/kanban templates and report templates.
- Controllers provide website/portal routes when present.
- Wizards are UI flows implemented with `models.TransientModel`.
- Data XML loads data/demo records; Security defines groups and access.

View file

@ -0,0 +1,3 @@
# Configuration
Refer to Odoo settings for ai_oca_bridge_document_page. Configure related models, access rights, and options as needed.

View file

@ -0,0 +1,3 @@
# Controllers
This module does not define custom HTTP controllers.

View file

@ -0,0 +1,6 @@
# Dependencies
This addon depends on:
- [ai_oca_bridge](../../odoo-bringout-oca-ai-ai_oca_bridge)
- document_page

View file

@ -0,0 +1,4 @@
# FAQ
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
- Q: How to enable? A: Start server with --addon ai_oca_bridge_document_page or install in UI.

View file

@ -0,0 +1,7 @@
# Install
```bash
pip install odoo-bringout-oca-ai-ai_oca_bridge_document_page"
# or
uv pip install odoo-bringout-oca-ai-ai_oca_bridge_document_page"
```

View file

@ -0,0 +1,12 @@
# Models
Detected core models and extensions in ai_oca_bridge_document_page.
```mermaid
classDiagram
class document_page
```
Notes
- Classes show model technical names; fields omitted for brevity.
- Items listed under _inherit are extensions of existing models.

View file

@ -0,0 +1,6 @@
# Overview
Packaged Odoo addon: ai_oca_bridge_document_page. Provides features documented in upstream Odoo 16 under this addon.
- Source: OCA/OCB 16.0, addon ai_oca_bridge_document_page
- License: LGPL-3

View file

@ -0,0 +1,3 @@
# Reports
This module does not define custom reports.

View file

@ -0,0 +1,8 @@
# Security
This module does not define custom security rules or access controls beyond Odoo defaults.
Default Odoo security applies:
- Base user access through standard groups
- Model access inherited from dependencies
- No custom row-level security rules

View file

@ -0,0 +1,5 @@
# Troubleshooting
- Ensure Python and Odoo environment matches repo guidance.
- Check database connectivity and logs if startup fails.
- Validate that dependent addons listed in DEPENDENCIES.md are installed.

View file

@ -0,0 +1,7 @@
# Usage
Start Odoo including this addon (from repo root):
```bash
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon ai_oca_bridge_document_page
```

View file

@ -0,0 +1,3 @@
# Wizards
This module does not include UI wizards.

View file

@ -0,0 +1,43 @@
[project]
name = "odoo-bringout-oca-ai-ai_oca_bridge_document_page"
version = "16.0.0"
description = "Ai Oca Bridge Document Page - Adds Documents synchronization using AI Bridges"
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-ai-ai_oca_bridge>=16.0.0",
"odoo-bringout-oca-ai-document_page>=16.0.0",
"requests>=2.25.1"
]
readme = "README.md"
requires-python = ">= 3.11"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business",
]
[project.urls]
homepage = "https://github.com/bringout/0"
repository = "https://github.com/bringout/0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["ai_oca_bridge_document_page"]
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.4.1",
]