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,36 @@
/** @odoo-module **/
// ensure mail mock server is loaded first.
import "@mail/../tests/helpers/mock_server";
import {MockServer} from "@web/../tests/helpers/mock_server";
import {patch} from "@web/core/utils/patch";
patch(MockServer.prototype, "ai_oca_bridge", {
async _performRPC(route, args) {
if (args.model === "ai.bridge" && args.method === "execute_ai_bridge") {
const record = this.models["ai.bridge"].records.filter(
(record) => record.id === args.args[0][0]
);
if (record && record[0].result_type === "action") {
return {
action: {
type: "ir.actions.act_window",
res_model: "res.partner",
views: [[false, "tree"]],
},
};
}
return {
notification: {
body: "Mocked AI Bridge Response",
args: {
type: "info",
title: "AI Bridge Notification",
},
},
};
}
return this._super(...arguments);
},
});

View file

@ -0,0 +1,29 @@
/** @odoo-module **/
import {
addModelNamesToFetch,
insertModelFields,
insertRecords,
} from "@bus/../tests/helpers/model_definitions_helpers";
addModelNamesToFetch(["ai.bridge"]);
insertModelFields("res.partner", {
ai_bridge_info: {default: [], type: "json"},
});
insertModelFields("ai.bridge", {
result_type: {
default: "none",
type: "selection",
selection: [
["none", "None"],
["action", "Action"],
["notification", "Notification"],
],
},
name: {string: "Name", type: "char"},
});
insertRecords("ai.bridge", [
{id: 1, name: "Test AI Bridge", result_type: "none"},
{id: 2, name: "Test AI Bridge Action", result_type: "action"},
]);