Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ai_oca_bridge/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=============
AI OCA Bridge
=============
Expand All @@ -17,7 +13,7 @@ AI OCA Bridge
.. |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/license-AGPL--3-blue.png
.. |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
Expand Down Expand Up @@ -187,6 +183,10 @@ Contributors

- Valentín Vinagre

- `Binhex <https://www.binhex.cloud/>`__

- Adria Hortoneda

Maintainers
-----------

Expand Down
3 changes: 2 additions & 1 deletion ai_oca_bridge/models/ai_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class AiBridge(models.Model):
user_id = fields.Many2one(
"res.users",
default=lambda self: self.env.user,
help="The user that will be shown when executing this AI bridge.",
required=True,
help="The user who execute the bridge.",
)
payload_type = fields.Selection(
[
Expand Down
2 changes: 1 addition & 1 deletion ai_oca_bridge/models/ai_bridge_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _process_response_none(self, response):
return {}

def _process_response_message(self, response):
return {"id": self._get_channel().message_post(**response).id}
return {"id": self._get_channel().sudo().message_post(**response).id}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use a sudo here. If the user has no permissions, it should fail IMO


def _process_response_action(self, response):
if response.get("action"):
Expand Down
5 changes: 4 additions & 1 deletion ai_oca_bridge/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
- [Sygel Technology](https://www.sygel.es)

- Valentín Vinagre


- [Binhex](https://www.binhex.cloud/)

- Adria Hortoneda
54 changes: 26 additions & 28 deletions ai_oca_bridge/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>AI OCA Bridge</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="ai-oca-bridge">
<h1 class="title">AI OCA Bridge</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="ai-oca-bridge">
<h1>AI OCA Bridge</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f8915001605720e33f96f0e2a995ad8ee969e822c1ac34978800c880ed7093bd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/ai/tree/16.0/ai_oca_bridge"><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"><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><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"><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"><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 used to create a bridge between Odoo and other AI systems
like n8n.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -409,7 +404,7 @@ <h1>AI OCA Bridge</h1>
</ul>
</div>
<div class="section" id="use-cases-context">
<h2><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h1>
<p>Right now, there are 2 different approaches for AI integration with
Odoo:</p>
<ol class="arabic simple">
Expand All @@ -430,17 +425,17 @@ <h2><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h2>
be used as Bridge with AI systems.</p>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
<p>As an administrator access <tt class="docutils literal">AI Bridge\AI Bridge</tt>.</p>
<p>Create a new bridge. Define the name, model, url and configuration.</p>
<p>In order to improve the view of the AI configuration, use groups and
domain to set better filters.</p>
<div class="section" id="payload-configuration">
<h3><a class="toc-backref" href="#toc-entry-3">Payload Configuration</a></h3>
<h2><a class="toc-backref" href="#toc-entry-3">Payload Configuration</a></h2>
<p>On the external system, you will receive a POST payload. The data
included will be the following:</p>
<div class="section" id="general">
<h4><a class="toc-backref" href="#toc-entry-4">General</a></h4>
<h3><a class="toc-backref" href="#toc-entry-4">General</a></h3>
<ul class="simple">
<li>_odoo: Standard data to identify the Odoo Database</li>
<li>_model: Model of the related object</li>
Expand All @@ -449,16 +444,16 @@ <h4><a class="toc-backref" href="#toc-entry-4">General</a></h4>
</ul>
</div>
<div class="section" id="record-payload">
<h4><a class="toc-backref" href="#toc-entry-5">Record Payload</a></h4>
<h3><a class="toc-backref" href="#toc-entry-5">Record Payload</a></h3>
<p>Adds a new item called record with all the fields.</p>
</div>
<div class="section" id="record-payload-v0">
<h4><a class="toc-backref" href="#toc-entry-6">Record Payload (v0)</a></h4>
<h3><a class="toc-backref" href="#toc-entry-6">Record Payload (v0)</a></h3>
<p>Adds all the fields directly on the payload. It will be removed on 17.0.</p>
</div>
</div>
<div class="section" id="asynchronous-and-synchronous-calls">
<h3><a class="toc-backref" href="#toc-entry-7">Asynchronous and synchronous calls</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">Asynchronous and synchronous calls</a></h2>
<p>The new system allows asynchronous and synchronous calls. Asynchronous
calls makes sense when the task to be processed don’t need to be
immediate. For example, reviewing an invoice and leave a comment with
Expand All @@ -473,21 +468,21 @@ <h3><a class="toc-backref" href="#toc-entry-7">Asynchronous and synchronous call
automatically on the synchronous call.</p>
</div>
<div class="section" id="result-processing">
<h3><a class="toc-backref" href="#toc-entry-8">Result processing</a></h3>
<h2><a class="toc-backref" href="#toc-entry-8">Result processing</a></h2>
<p>With the answers of the system we expect to do something about it. We
have the following options:</p>
<div class="section" id="no-processing">
<h4><a class="toc-backref" href="#toc-entry-9">No processing</a></h4>
<h3><a class="toc-backref" href="#toc-entry-9">No processing</a></h3>
<p>In this case, the result will do nothing</p>
</div>
<div class="section" id="post-a-message">
<h4><a class="toc-backref" href="#toc-entry-10">Post a Message</a></h4>
<h3><a class="toc-backref" href="#toc-entry-10">Post a Message</a></h3>
<p>We will post a message on the original thread of the system. The thread
is computed by a function, so it can be overriden in future modules. It
expects the keyword arguments of the <tt class="docutils literal">message_post</tt> function.</p>
</div>
<div class="section" id="action">
<h4><a class="toc-backref" href="#toc-entry-11">Action</a></h4>
<h3><a class="toc-backref" href="#toc-entry-11">Action</a></h3>
<p>It expects to launch an action on the user interface. It only makes
sense on synchronous calls.</p>
<p>It expects an action item with the following parameters:</p>
Expand All @@ -500,36 +495,36 @@ <h4><a class="toc-backref" href="#toc-entry-11">Action</a></h4>
</div>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-12">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-12">Usage</a></h1>
<p>Use the bolt widget in the chatter to execute the different AI options.</p>
<p>The options will be filtered according to the configuration.</p>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-13">Known issues / Roadmap</a></h2>
<h1><a class="toc-backref" href="#toc-entry-13">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Define examples to use and import</li>
<li>Allow child fields. Right now, only first level fields are accepted.</li>
<li>Information popover is not working properly when there is large data.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-14">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-14">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%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">
<h2><a class="toc-backref" href="#toc-entry-15">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-15">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-16">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-16">Authors</a></h2>
<ul class="simple">
<li>Dixmit</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-17">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-17">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.dixmit.com">Dixmit</a><ul>
<li>Enric Tobella</li>
Expand All @@ -539,10 +534,14 @@ <h3><a class="toc-backref" href="#toc-entry-17">Contributors</a></h3>
<li>Valentín Vinagre</li>
</ul>
</li>
<li><a class="reference external" href="https://www.binhex.cloud/">Binhex</a><ul>
<li>Adria Hortoneda</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-18">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-18">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" />
Expand All @@ -555,6 +554,5 @@ <h3><a class="toc-backref" href="#toc-entry-18">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions ai_oca_bridge/views/ai_bridge.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
attrs="{'invisible': [('result_kind', '!=', 'async')]}"
/>
<field name="result_type" />
<field name="user_id" />
<field
name="model_id"
options="{'no_create': True, 'no_create_edit': True}"
Expand Down