@ -0,0 +1,51 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
Hide Any Menu User Wise |
||||
|
======================== |
||||
|
* Hide Any Menu User Wise |
||||
|
|
||||
|
Installation |
||||
|
============ |
||||
|
- www.odoo.com/documentation/17.0/setup/install.html |
||||
|
- Install our custom addon |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
- Additional configuration not required |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Lesser General Public License, Version 3 (LGPL v3). |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developer: (V17)Ranjith R , (V18)Sreerag PM |
||||
|
Contact : odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import models |
@ -0,0 +1,42 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': 'Hide Any Menu User Wise', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Extra Tools', |
||||
|
'summary': 'Hide Menu, Odoo18 Hide Menu, Hide Menu Odoo, Restrict Menu Items, Odoo18 Menu, Odoo18, Odoo Apps', |
||||
|
'description': 'Hide Any Menu Item User Wise, Hide Menu Items, Hide Menu', |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.cybrosys.com", |
||||
|
'depends': ['base'], |
||||
|
'data': [ |
||||
|
'security/security.xml', |
||||
|
'views/res_users_views.xml', |
||||
|
], |
||||
|
'license': 'LGPL-3', |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
## Module <hide_menu_user> |
||||
|
|
||||
|
#### 04.10.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
#### ADD |
||||
|
|
||||
|
- Initial commit for Hide Any Menu User Wise |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import res_users |
@ -0,0 +1,79 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class ResUsers(models.Model): |
||||
|
""" |
||||
|
Model to handle hiding specific menu items for certain users. |
||||
|
""" |
||||
|
_inherit = 'res.users' |
||||
|
|
||||
|
def write(self, vals): |
||||
|
""" |
||||
|
Write method for the ResUsers model. |
||||
|
Ensure the menu will not remain hidden after removing it from the list. |
||||
|
""" |
||||
|
res = super(ResUsers, self).write(vals) |
||||
|
for record in self: |
||||
|
for menu in record.hide_menu_ids: |
||||
|
menu.write({ |
||||
|
'restrict_user_ids': [fields.Command.link(record.id)] |
||||
|
}) |
||||
|
# Handle unlinked menus (removed from hide_menu_ids) |
||||
|
previous_menus = self.env['ir.ui.menu'].search( |
||||
|
[('restrict_user_ids', 'in', [record.id])]) |
||||
|
removed_menus = previous_menus - record.hide_menu_ids |
||||
|
for menu in removed_menus: |
||||
|
menu.write({ |
||||
|
'restrict_user_ids': [fields.Command.unlink(record.id)] |
||||
|
}) |
||||
|
return res |
||||
|
|
||||
|
def _get_is_admin(self): |
||||
|
""" |
||||
|
Compute method to check if the user is an admin. |
||||
|
The Hide specific menu tab will be hidden for the Admin user form. |
||||
|
""" |
||||
|
for rec in self: |
||||
|
rec.is_admin = False |
||||
|
if rec.id == self.env.ref('base.user_admin').id: |
||||
|
rec.is_admin = True |
||||
|
|
||||
|
hide_menu_ids = fields.Many2many( |
||||
|
'ir.ui.menu', string="Hidden Menu", |
||||
|
store=True, help='Select menu items that need to ' |
||||
|
'be hidden to this user.') |
||||
|
is_admin = fields.Boolean(compute=_get_is_admin, string="Is Admin", |
||||
|
help='Check if the user is an admin.') |
||||
|
|
||||
|
|
||||
|
|
||||
|
class IrUiMenu(models.Model): |
||||
|
""" |
||||
|
Model to restrict the menu for specific users. |
||||
|
""" |
||||
|
_inherit = 'ir.ui.menu' |
||||
|
|
||||
|
restrict_user_ids = fields.Many2many( |
||||
|
'res.users', string="Restricted Users", |
||||
|
help='Users restricted from accessing this menu.') |
@ -0,0 +1,9 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!--Rule to hide menu items --> |
||||
|
<record id="ir_ui_menu_rule_user" model="ir.rule"> |
||||
|
<field name="name">Restrict Menu from Users</field> |
||||
|
<field name="model_id" ref="model_ir_ui_menu"/> |
||||
|
<field name="domain_force">[('restrict_user_ids','not in',user.id)]</field> |
||||
|
</record> |
||||
|
</odoo> |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 162 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 723 KiB |
After Width: | Height: | Size: 177 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 54 KiB |
@ -0,0 +1,36 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!--Inheriting fields to res.users and ir.ui.menu--> |
||||
|
<record id="view_users_form" model="ir.ui.view"> |
||||
|
<field name="name">res.users.view.form.inherit.hide.menu.user</field> |
||||
|
<field name="model">res.users</field> |
||||
|
<field name="inherit_id" ref="base.view_users_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//notebook" position="inside"> |
||||
|
<page string="Hide Specific Menu" invisible="is_admin"> |
||||
|
<list> |
||||
|
<field name="hide_menu_ids"/> |
||||
|
</list> |
||||
|
</page> |
||||
|
</xpath> |
||||
|
<field name="name" position="after"> |
||||
|
<field name="is_admin" invisible="1"/> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!--Inherited view of the model ir.ui.menu--> |
||||
|
<record id="edit_menu_access" model="ir.ui.view"> |
||||
|
<field name="name">ir.ui.menu.view.form.inherit.hide.menu.user</field> |
||||
|
<field name="model">ir.ui.menu</field> |
||||
|
<field name="inherit_id" ref="base.edit_menu_access"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//notebook" position="inside"> |
||||
|
<page string="Restrict users" name="restrict_users"> |
||||
|
<list> |
||||
|
<field name="restrict_user_ids"/> |
||||
|
</list> |
||||
|
</page> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |