diff --git a/hide_menu_user/README.rst b/hide_menu_user/README.rst index 874cd5138..feb86b835 100644 --- a/hide_menu_user/README.rst +++ b/hide_menu_user/README.rst @@ -21,7 +21,6 @@ Credits * Developer: (v14) Sreerag @ Cybrosys - Contacts -------- * Mail Contact : odoo@cybrosys.com diff --git a/hide_menu_user/__init__.py b/hide_menu_user/__init__.py index f2c5a4636..366bd5186 100644 --- a/hide_menu_user/__init__.py +++ b/hide_menu_user/__init__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Copyright (C) 2022-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -21,3 +21,4 @@ ############################################################################# from . import models +from . import wizard diff --git a/hide_menu_user/__manifest__.py b/hide_menu_user/__manifest__.py index 67ab224ba..aa450595a 100644 --- a/hide_menu_user/__manifest__.py +++ b/hide_menu_user/__manifest__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Copyright (C) 2022-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -22,7 +22,8 @@ { 'name': 'Hide Any Menu User Wise', - 'version': '14.0.1.0.1', + 'version': '14.0.1.1.1', + 'category': 'Extra Tools', 'summary': 'Hide Any Menu Item User Wise', 'description': 'Hide Any Menu Item User Wise, Hide Menu Items, Hide Menu', 'author': 'Cybrosys Techno Solutions', @@ -31,9 +32,16 @@ 'website': "https://www.cybrosys.com", 'depends': ['base'], 'data': [ + 'security/security.xml', + 'security/ir.model.access.csv', 'views/res_users.xml', - 'security/security.xml' + 'wizard/import__menu_list_views.xml', ], + "external_dependencies": { + "python": [ + "openpyxl", + ], + }, 'license': 'LGPL-3', 'images': ['static/description/banner.png'], 'installable': True, diff --git a/hide_menu_user/doc/RELEASE_NOTES.md b/hide_menu_user/doc/RELEASE_NOTES.md index 20adf3630..9ea57002e 100644 --- a/hide_menu_user/doc/RELEASE_NOTES.md +++ b/hide_menu_user/doc/RELEASE_NOTES.md @@ -1,9 +1,10 @@ ## Module - #### 15.07.2021 #### Version 14.0.1.0.0 #### ADD - Initial commit for hide_menu_user - - +### 24.02.2023 +### Version 14.0.1.1.1 +### ADD +- Added a new feature, to import the list of hide specific menus diff --git a/hide_menu_user/models/__init__.py b/hide_menu_user/models/__init__.py index 3caa43d73..78ab8e00e 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) 2021-TODAY Cybrosys Technologies() +# Copyright (C) 2022-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -19,5 +19,5 @@ # If not, see . # ############################################################################# - from . import res_user +from . import restrict_menu diff --git a/hide_menu_user/models/res_user.py b/hide_menu_user/models/res_user.py index a0347e276..bf7dd8178 100644 --- a/hide_menu_user/models/res_user.py +++ b/hide_menu_user/models/res_user.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2021-TODAY Cybrosys Technologies() +# Copyright (C) 2022-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -22,16 +22,17 @@ from odoo import models, fields, api + class HideMenuUser(models.Model): + """ Inherited Users""" _inherit = 'res.users' - @api.model_create_multi - def create(self, vals_list): + @api.model + def create(self, vals): """ Else the menu will be still hidden even after removing from the list """ - for vals in vals_list: - self.clear_caches() + self.clear_caches() return super(HideMenuUser, self).create(vals) def write(self, vals): @@ -43,7 +44,6 @@ class HideMenuUser(models.Model): menu.write({ 'restrict_user_ids': [(4, self.id)] }) - print(res,'resssssssssss') self.clear_caches() return res @@ -62,7 +62,17 @@ class HideMenuUser(models.Model): 'hidden to this user ') is_admin = fields.Boolean(compute=_get_is_admin) -class RestrictMenu(models.Model): - _inherit = 'ir.ui.menu' - - restrict_user_ids = fields.Many2many('res.users') + def action_import(self): + """This function will open a wizard where you can select the file which want to be import""" + wizard = self.env['import.menu.list.wizard'].create({ + 'name': self.name, + 'user_id': self.id + }) + return { + 'name': 'Wizard', + 'type': 'ir.actions.act_window', + 'res_model': 'import.menu.list.wizard', + 'view_mode': 'form', + 'res_id': wizard.id, + 'target': 'new' + } diff --git a/hide_menu_user/models/restrict_menu.py b/hide_menu_user/models/restrict_menu.py new file mode 100644 index 000000000..cb143f3d5 --- /dev/null +++ b/hide_menu_user/models/restrict_menu.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 . +# +############################################################################# + +from odoo import models, fields + + +class RestrictMenu(models.Model): + """ Inherited Menu Items""" + _inherit = 'ir.ui.menu' + + restrict_user_ids = fields.Many2many('res.users', store=True) diff --git a/hide_menu_user/security/ir.model.access.csv b/hide_menu_user/security/ir.model.access.csv new file mode 100644 index 000000000..9eae37a1d --- /dev/null +++ b/hide_menu_user/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_import_menu_list_wizard,access_import_menu_list_wizard,model_import_menu_list_wizard,base.group_user,1,1,1,1 diff --git a/hide_menu_user/security/security.xml b/hide_menu_user/security/security.xml index ad9d5ec3b..8d566de28 100644 --- a/hide_menu_user/security/security.xml +++ b/hide_menu_user/security/security.xml @@ -1,9 +1,8 @@ + - Restrict Menu from Users [('restrict_user_ids','not in',user.id)] - - \ No newline at end of file + diff --git a/hide_menu_user/static/description/images/003.png b/hide_menu_user/static/description/images/003.png new file mode 100644 index 000000000..dda43c57d Binary files /dev/null and b/hide_menu_user/static/description/images/003.png differ diff --git a/hide_menu_user/static/description/images/1.png b/hide_menu_user/static/description/images/1.png new file mode 100644 index 000000000..d875d30ee Binary files /dev/null and b/hide_menu_user/static/description/images/1.png differ diff --git a/hide_menu_user/static/description/images/14.png b/hide_menu_user/static/description/images/14.png new file mode 100644 index 000000000..ba0dc2a2b Binary files /dev/null and b/hide_menu_user/static/description/images/14.png differ diff --git a/hide_menu_user/static/description/images/2.png b/hide_menu_user/static/description/images/2.png new file mode 100644 index 000000000..76ee248c3 Binary files /dev/null and b/hide_menu_user/static/description/images/2.png differ diff --git a/hide_menu_user/static/description/images/4.png b/hide_menu_user/static/description/images/4.png new file mode 100644 index 000000000..8cc053f0b Binary files /dev/null and b/hide_menu_user/static/description/images/4.png differ diff --git a/hide_menu_user/static/description/images/6.png b/hide_menu_user/static/description/images/6.png new file mode 100644 index 000000000..a56b46932 Binary files /dev/null and b/hide_menu_user/static/description/images/6.png differ diff --git a/hide_menu_user/static/description/images/7.png b/hide_menu_user/static/description/images/7.png new file mode 100644 index 000000000..5e305b0bd Binary files /dev/null and b/hide_menu_user/static/description/images/7.png differ diff --git a/hide_menu_user/static/description/images/8.png b/hide_menu_user/static/description/images/8.png new file mode 100644 index 000000000..ed5f718c6 Binary files /dev/null and b/hide_menu_user/static/description/images/8.png differ diff --git a/hide_menu_user/static/description/images/9.png b/hide_menu_user/static/description/images/9.png new file mode 100644 index 000000000..5ab664b4e Binary files /dev/null and b/hide_menu_user/static/description/images/9.png differ diff --git a/hide_menu_user/static/description/index.html b/hide_menu_user/static/description/index.html index cd7884316..8d7970fed 100644 --- a/hide_menu_user/static/description/index.html +++ b/hide_menu_user/static/description/index.html @@ -126,25 +126,27 @@ style="margin-top: -15px !important; margin-top: 1rem !important; margin-bottom: 4rem !important;"> + +

- 03

+ 04

- Hiding the menu + Select the menu

- Let's select these menu for this user 'Mark Demo' + Select those menus and save

- @@ -153,20 +155,20 @@

- 04

+ 05

- Select the menu + Menus are Hidden

- Select those menus and save + As you can see the menus and corresponding views are now hidden for the user

- @@ -175,43 +177,239 @@

- 05

+ 06

- Menus are Hidden + Option hidden for Admin user

- As you can see the menus and corresponding views are now hidden for the user + Option to hide menu for an admin user is disabled as this may create issues in the + workflow

- + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

+ 07

+
+
+

+ Select Add a line option from the order line +

+

+ To export the list of menu, first we want to select the menus, for that click on add a line +

+
+
+ +

- 06

+ 08

- Option hidden for Admin user + Select the menus that we want to export

- Option to hide menu for an admin user is disabled as this may create issues in the - workflow + From the list of menus, we can select the menu items that we want to export. After that + click on export option

- + +
+
+

+ 09

+
+
+

+ Select the Parent Path to fields to export +

+

+ From the left side of the window, we are able to select the fields that we want to export. + Don't forget to add the Parent Path to fields to export + +

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

+ 10

+
+
+

+ Click on export button +

+

+ Now export the selected list of menu by clicking on Export button +

+ +
+
+ + + +
+
+

+ 11

+
+
+

+ Select the User +

+

+ + Select the User to whom which we want to import the list of menus +

+ +
+
+ + + +
+
+

+ 12

+
+
+

+ Click on Import button +

+

+ + In the page 'Hide Specific Menu', you can see a Import button. click on that +

+ +
+
+ + + +
+
+

+ 13

+
+
+

+ Upload the file +

+

+ A wizard will open, and we are able to upload the file in xls format.Finally click on Import button +

+ +
+
+ + + +
+
+

+ 14

+
+
+

+ Imported the menus +

+

+ + List of menus are imported in the order line +

+ +
+
+ diff --git a/hide_menu_user/views/res_users.xml b/hide_menu_user/views/res_users.xml index 831b7f770..ec2ac901b 100644 --- a/hide_menu_user/views/res_users.xml +++ b/hide_menu_user/views/res_users.xml @@ -1,3 +1,4 @@ + @@ -6,7 +7,11 @@ - + +