first commit

This commit is contained in:
Suherdy Yacob 2026-01-29 16:57:39 +07:00
commit 69eedcc142
8 changed files with 91 additions and 0 deletions

14
.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
# Python
__pycache__/
*.py[cod]
*$py.class
# Odoo
.ipynb_checkpoints/
odoo/
.env
# Editor
.vscode/
.idea/
*.swp

21
README.md Normal file
View File

@ -0,0 +1,21 @@
# Custom Disable AI Icon
This module allows administrators to hide the AI assistant icon in the systray (top right corner) for specific users.
## Features
- adds a new security group "Hide AI Icon".
- Hides the AI icon in the web client for users belonging to this group.
## Installation
1. Place the module in your Odoo `addons` path.
2. Update the app list.
3. Install the "Custom Disable AI Icon" module.
## Configuration
To hide the AI icon for a user:
1. Go to **Settings > Users & Companies > Users**.
2. Select the user.
3. In the **Access Rights** tab, scroll to the **Administration** section (or check other sections depending on Odoo version layout).
4. Check the box **"Hide AI Icon"**.
5. Save the user record.
6. The user may need to refresh their browser for the change to take effect.

1
__init__.py Normal file
View File

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

16
__manifest__.py Normal file
View File

@ -0,0 +1,16 @@
{
'name': 'Custom Disable AI Icon',
'version': '1.0',
'category': 'Hidden',
'summary': 'Hide AI Icon for specific users',
'depends': ['ai', 'web'],
'data': [
'security/security.xml',
],
'assets': {
'web.assets_backend': [
'custom_disable_ai/static/src/systray_patch.js',
],
},
'license': 'LGPL-3',
}

1
models/__init__.py Normal file
View File

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

9
models/ir_http.py Normal file
View File

@ -0,0 +1,9 @@
from odoo import models
class IrHttp(models.AbstractModel):
_inherit = 'ir.http'
def session_info(self):
result = super().session_info()
result['is_ai_hidden'] = self.env.user.has_group('custom_disable_ai.group_hide_ai_icon')
return result

15
security/security.xml Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="privilege_hide_ai_icon" model="res.groups.privilege">
<field name="name">AI Icon Visibility</field>
<field name="category_id" ref="base.module_category_administration"/>
</record>
<record id="group_hide_ai_icon" model="res.groups">
<field name="name">Hide AI Icon</field>
<field name="privilege_id" ref="privilege_hide_ai_icon"/>
<field name="user_ids" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>
</data>
</odoo>

View File

@ -0,0 +1,14 @@
import { registry } from "@web/core/registry";
import { session } from "@web/session";
const systrayRegistry = registry.category("systray");
const originalAIItem = systrayRegistry.get("ai.systray_action");
if (originalAIItem) {
systrayRegistry.add("ai.systray_action", {
...originalAIItem,
isDisplayed: (env) => {
return !session.is_ai_hidden;
}
}, { force: true });
}