diff --git a/hide_menu_user/__init__.py b/hide_menu_user/__init__.py index 097bdb395..6eeac8379 100644 --- a/hide_menu_user/__init__.py +++ b/hide_menu_user/__init__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Copyright (C) 2025-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER diff --git a/hide_menu_user/__manifest__.py b/hide_menu_user/__manifest__.py index 2a3001805..5534534f0 100644 --- a/hide_menu_user/__manifest__.py +++ b/hide_menu_user/__manifest__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Copyright (C) 2025-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -21,7 +21,7 @@ ############################################################################# { 'name': 'Hide Any Menu User Wise', - 'version': '18.0.1.0.0', + 'version': '18.0.2.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', diff --git a/hide_menu_user/doc/RELEASE_NOTES.md b/hide_menu_user/doc/RELEASE_NOTES.md index 60803efa3..af90d7de5 100644 --- a/hide_menu_user/doc/RELEASE_NOTES.md +++ b/hide_menu_user/doc/RELEASE_NOTES.md @@ -5,3 +5,9 @@ #### ADD - Initial commit for Hide Any Menu User Wise + +#### 11.06.2025 +#### Version 18.0.2.0.0 +#### UPDT + +- Updated the module workflow, Only to type internal user can can hide the menu items. diff --git a/hide_menu_user/models/__init__.py b/hide_menu_user/models/__init__.py index 2ce1fe941..10c2bffd9 100644 --- a/hide_menu_user/models/__init__.py +++ b/hide_menu_user/models/__init__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Copyright (C) 2025-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER diff --git a/hide_menu_user/models/res_users.py b/hide_menu_user/models/res_users.py index babebf142..e8afb1e85 100644 --- a/hide_menu_user/models/res_users.py +++ b/hide_menu_user/models/res_users.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Copyright (C) 2025-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -20,7 +20,7 @@ # ############################################################################# -from odoo import fields, models, api +from odoo import api, fields, models class ResUsers(models.Model): @@ -36,11 +36,9 @@ class ResUsers(models.Model): for record in self: old_hide_menu_ids = old_hide_menu_map.get(record.id, self.env['ir.ui.menu']) - # Add new restrictions for menu in record.hide_menu_ids: menu.sudo().write({'restrict_user_ids': [(4, record.id)]}) - # Remove old ones that are no longer selected removed_menus = old_hide_menu_ids - record.hide_menu_ids for menu in removed_menus: @@ -63,6 +61,21 @@ class ResUsers(models.Model): 'be hidden to this user.') is_admin = fields.Boolean(compute='_get_is_admin', string="Is Admin", help='Check if the user is an admin.') + is_show_specific_menu = fields.Boolean(string='Is Show Specific Menu', compute='_compute_is_show_specific_menu', + help='Field determine to show the hide specific menu') + + @api.depends('groups_id') + def _compute_is_show_specific_menu(self): + """ compute function of the field is show specific menu """ + group_id = self.env.ref('base.group_user') + for rec in self: + if group_id.name in rec.groups_id.mapped('name'): + rec.is_show_specific_menu = False + else: + for menu in rec.hide_menu_ids: + menu.restrict_user_ids = [fields.Command.unlink(rec.id)] + rec.hide_menu_ids = [fields.Command.clear()] + rec.is_show_specific_menu = True class IrUiMenu(models.Model): diff --git a/hide_menu_user/views/res_users_views.xml b/hide_menu_user/views/res_users_views.xml index 0bb0613c0..adc934810 100644 --- a/hide_menu_user/views/res_users_views.xml +++ b/hide_menu_user/views/res_users_views.xml @@ -7,7 +7,7 @@ - +