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
121 changes: 121 additions & 0 deletions ai_oca_bridge_sale/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
==================
AI OCA Bridge Sale
==================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7db759bf0f80da243772d180303cb0e39243db662bf554ee4adbe340d61c2d92
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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_sale
: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_sale
: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 to allow external AI systems to perform actions
with the correct context, based on triggers related to Sales management.

**Table of contents**

.. contents::
:local:

Configuration
=============

- **Bridge with ``Usage = "AI Thread Create"``** Processes new sale
orders and order lines in the external system for AI-enhanced actions
like sales analysis, customer insights, or automated sales processes.

- **Bridge with ``Usage = "AI Thread Write"``** Updates sale order and
order line information in the external system when they are modified
in Odoo.

- **Bridge with ``Usage = "AI Thread Unlink"``** Removes sale order and
order line data from the external system when they 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: depending on your use case.
- Model: select the "Sale Order" or "Sale Order Line" model
- Field: add at least the fields the endpoint is expecting (e.g., name,
partner, product, quantity, state, etc.).
- Filter: add a domain for using the bridge only with the sale
orders/order lines intended to trigger automatic actions

Usage
=====

Depending on the bridges you have created, create, update or delete a
sale order or order line record matching the bridge domain. You should
see the execution on the AI Bridge Execution menu.

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_sale%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
-------

* Escodoo

Contributors
------------

- `Escodoo <https://www.escodoo.com.br>`__:

- Marcel Savegnago <marcel.savegnago@escodoo.com.br>

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.

.. |maintainer-marcelsavegnago| image:: https://github.com/marcelsavegnago.png?size=40px
:target: https://github.com/marcelsavegnago
:alt: marcelsavegnago

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-marcelsavegnago|

This module is part of the `OCA/ai <https://github.com/OCA/ai/tree/16.0/ai_oca_bridge_sale>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions ai_oca_bridge_sale/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions ai_oca_bridge_sale/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2025 Escodoo
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "AI OCA Bridge Sale",
"summary": """Adds Sale triggers for AI Bridges""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Escodoo,Odoo Community Association (OCA)",
"maintainers": ["marcelsavegnago"],
"category": "AI",
"website": "https://github.com/OCA/ai",
"depends": [
"ai_oca_bridge",
"sale",
],
"data": [],
"demo": [
"demo/ai_bridge_demo.xml",
],
}
116 changes: 116 additions & 0 deletions ai_oca_bridge_sale/demo/ai_bridge_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- Sale Order AI Bridges -->
<record id="ai_bridge_sale_order_create" model="ai.bridge">
<field name="name">Sale Order AI Bridge - Create</field>
<field name="description">
<![CDATA[
<p>This AI bridge is triggered when a new sale order is created.</p>
]]>
</field>
<field name="model_id" ref="sale.model_sale_order" />
<field name="usage">ai_thread_create</field>
<field name="url">https://api.example.com/ai/sale_order/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('sale.field_sale_order__name'), ref('sale.field_sale_order__partner_id'), ref('sale.field_sale_order__state')])]"
/>
</record>

<record id="ai_bridge_sale_order_write" model="ai.bridge">
<field name="name">Sale Order AI Bridge - Update</field>
<field name="description">
<![CDATA[
<p>This AI bridge is triggered when a sale order is updated.</p>
]]>
</field>
<field name="model_id" ref="sale.model_sale_order" />
<field name="usage">ai_thread_write</field>
<field name="url">https://api.example.com/ai/sale_order/update</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('sale.field_sale_order__name'), ref('sale.field_sale_order__partner_id'), ref('sale.field_sale_order__state')])]"
/>
</record>

<record id="ai_bridge_sale_order_unlink" model="ai.bridge">
<field name="name">Sale Order AI Bridge - Delete</field>
<field name="description">
<![CDATA[
<p>This AI bridge is triggered when a sale order is deleted.</p>
]]>
</field>
<field name="model_id" ref="sale.model_sale_order" />
<field name="usage">ai_thread_unlink</field>
<field name="url">https://api.example.com/ai/sale_order/delete</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>

<!-- Sale Order Line AI Bridges -->
<record id="ai_bridge_sale_order_line_create" model="ai.bridge">
<field name="name">Sale Order Line AI Bridge - Create</field>
<field name="description">
<![CDATA[
<p>This AI bridge is triggered when a new sale order line is created.</p>
]]>
</field>
<field name="model_id" ref="sale.model_sale_order_line" />
<field name="usage">ai_thread_create</field>
<field name="url">https://api.example.com/ai/sale_order_line/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('sale.field_sale_order_line__name'), ref('sale.field_sale_order_line__product_id'), ref('sale.field_sale_order_line__product_uom_qty')])]"
/>
</record>

<record id="ai_bridge_sale_order_line_write" model="ai.bridge">
<field name="name">Sale Order Line AI Bridge - Update</field>
<field name="description">
<![CDATA[
<p>This AI bridge is triggered when a sale order line is updated.</p>
]]>
</field>
<field name="model_id" ref="sale.model_sale_order_line" />
<field name="usage">ai_thread_write</field>
<field name="url">https://api.example.com/ai/sale_order_line/update</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('sale.field_sale_order_line__name'), ref('sale.field_sale_order_line__product_id'), ref('sale.field_sale_order_line__product_uom_qty')])]"
/>
</record>

<record id="ai_bridge_sale_order_line_unlink" model="ai.bridge">
<field name="name">Sale Order Line AI Bridge - Delete</field>
<field name="description">
<![CDATA[
<p>This AI bridge is triggered when a sale order line is deleted.</p>
]]>
</field>
<field name="model_id" ref="sale.model_sale_order_line" />
<field name="usage">ai_thread_unlink</field>
<field name="url">https://api.example.com/ai/sale_order_line/delete</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>
2 changes: 2 additions & 0 deletions ai_oca_bridge_sale/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import sale_order
from . import sale_order_line
6 changes: 6 additions & 0 deletions ai_oca_bridge_sale/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from odoo import models


class SaleOrder(models.Model):
_inherit = ["sale.order", "ai.bridge.thread"]
_name = "sale.order"
6 changes: 6 additions & 0 deletions ai_oca_bridge_sale/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from odoo import models


class SaleOrderLine(models.Model):
_inherit = ["sale.order.line", "ai.bridge.thread"]
_name = "sale.order.line"
15 changes: 15 additions & 0 deletions ai_oca_bridge_sale/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- **Bridge with `Usage = "AI Thread Create"`**
Processes new sale orders and order lines in the external system for AI-enhanced actions like sales analysis, customer insights, or automated sales processes.

- **Bridge with `Usage = "AI Thread Write"`**
Updates sale order and order line information in the external system when they are modified in Odoo.

- **Bridge with `Usage = "AI Thread Unlink"`**
Removes sale order and order line data from the external system when they 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: depending on your use case.
- Model: select the "Sale Order" or "Sale Order Line" model
- Field: add at least the fields the endpoint is expecting (e.g., name, partner, product, quantity, state, etc.).
- Filter: add a domain for using the bridge only with the sale orders/order lines intended to trigger automatic actions
2 changes: 2 additions & 0 deletions ai_oca_bridge_sale/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Escodoo](https://www.escodoo.com.br):
- Marcel Savegnago \<marcel.savegnago@escodoo.com.br\>
1 change: 1 addition & 0 deletions ai_oca_bridge_sale/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module is intended to allow external AI systems to perform actions with the correct context, based on triggers related to Sales management.
1 change: 1 addition & 0 deletions ai_oca_bridge_sale/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Depending on the bridges you have created, create, update or delete a sale order or order line record matching the bridge domain. You should see the execution on the AI Bridge Execution menu.
Binary file added ai_oca_bridge_sale/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading