Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d09274b
[ADD] base_menu_visibility_restriction: Restrict (with groups) menu v…
victoralmau Nov 11, 2020
6fa3952
[UPD] Update base_menu_visibility_restriction.pot
oca-travis Dec 28, 2020
4a8edfd
[UPD] README.rst
OCA-git-bot Dec 28, 2020
01ae17b
[14.0][MIG] base_menu_visibility_restriction
aphon61bank Jan 25, 2021
d02a7bf
[UPD] Update base_menu_visibility_restriction.pot
oca-travis Apr 6, 2021
82afc6d
[UPD] README.rst
OCA-git-bot Apr 6, 2021
59da93c
[IMP] : black, isort, prettier
JasminSForgeFlow Dec 10, 2021
e4e84b6
[15.0][MIG] base_menu_visibility_restriction: Migration to 15.0
JasminSForgeFlow Dec 10, 2021
4fbbc26
[UPD] Update base_menu_visibility_restriction.pot
Dec 10, 2021
e2a8c1b
[UPD] README.rst
OCA-git-bot Dec 10, 2021
6acbed1
[IMP] base_menu_visibility_restriction: pre-commit stuff
dsolanki-initos Mar 20, 2023
c77d8b4
[MIG] base_menu_visibility_restriction: Migration to 16.0
dsolanki-initos Mar 20, 2023
48c5433
[UPD] Update base_menu_visibility_restriction.pot
Jun 22, 2023
4e9c513
[UPD] README.rst
OCA-git-bot Jun 22, 2023
1372607
Added translation using Weblate (Spanish)
kikopeiro Aug 28, 2023
3fd815c
[UPD] README.rst
OCA-git-bot Sep 3, 2023
b4ee171
Translated using Weblate (Spanish)
kikopeiro Aug 28, 2023
acc0db8
Added translation using Weblate (Italian)
mymage Dec 29, 2023
fed9754
Translated using Weblate (Italian)
mymage Dec 31, 2023
cd09ec7
[IMP] base_menu_visibility_restriction: pre-commit auto fixes
May 9, 2024
c0c1d3e
[MIG] base_menu_visibility_restriction: Migration to 17.0
May 9, 2024
f462e10
[UPD] Update base_menu_visibility_restriction.pot
Sep 16, 2024
4790d38
[BOT] post-merge updates
OCA-git-bot Sep 16, 2024
14e869a
Update translation files
weblate Sep 16, 2024
6176f37
[MIG] base_menu_visibility_restriction: Migration to 18.0
gustitammam Oct 15, 2024
71b1ec8
[UPD] Update base_menu_visibility_restriction.pot
Feb 28, 2025
cbf49aa
[BOT] post-merge updates
OCA-git-bot Feb 28, 2025
9c2d435
[19.0][MIG] base_menu_visibility_restriction
maciej-wichowski Oct 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions base_menu_visibility_restriction/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
================================
Base Menu Visibility Restriction
================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b277c03fb53b079398718103330c847501ece7fe944f8c0532b91434e3e1cc46
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github
:target: https://github.com/OCA/server-ux/tree/18.0/base_menu_visibility_restriction
:alt: OCA/server-ux
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-ux-18-0/server-ux-18-0-base_menu_visibility_restriction
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-ux&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This addon lets you assign "excluded groups" to menu items. If a user
belongs to a group that is assigned to a menu item as an excluded group,
the user will not be able to see the menu item.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

1. Activate the developer mode
2. Go to *Settings > Technical > User interface > Menu Items*.
3. Search for any menu and edit it.
4. Update "Excluded groups" with one group.
5. Login with a user of that group, and you won't see such menu.

You can try with demo data for the menu Apps > App Store and user demo.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-ux/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-ux/issues/new?body=module:%20base_menu_visibility_restriction%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:

- Víctor Martínez

- Dhara Solanki <[email protected]>
- Nedas Žilinskas <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px
:target: https://github.com/victoralmau
:alt: victoralmau

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victoralmau|

This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/18.0/base_menu_visibility_restriction>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions base_menu_visibility_restriction/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions base_menu_visibility_restriction/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2020 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Base Menu Visibility Restriction",
"version": "19.0.1.0.0",
"category": "Extra Tools",
"development_status": "Production/Stable",
"author": "Tecnativa, Odoo Community Association (OCA)",
"summary": "Restrict (with groups) menu visibilty",
"website": "https://github.com/OCA/server-ux",
"license": "AGPL-3",
"depends": ["web_tour"],
"maintainers": ["victoralmau"],
"data": ["views/ir_ui_menu.xml"],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_menu_visibility_restriction
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: base_menu_visibility_restriction
#: model:ir.model.fields,field_description:base_menu_visibility_restriction.field_ir_ui_menu__excluded_group_ids
msgid "Excluded Groups"
msgstr ""

#. module: base_menu_visibility_restriction
#: model:ir.model,name:base_menu_visibility_restriction.model_ir_ui_menu
msgid "Menu"
msgstr ""
30 changes: 30 additions & 0 deletions base_menu_visibility_restriction/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_menu_visibility_restriction
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-09-03 13:43+0000\n"
"Last-Translator: kikopeiro <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: base_menu_visibility_restriction
#: model:ir.model.fields,field_description:base_menu_visibility_restriction.field_ir_ui_menu__excluded_group_ids
msgid "Excluded Groups"
msgstr "Grupos excluidos"

#. module: base_menu_visibility_restriction
#: model:ir.model,name:base_menu_visibility_restriction.model_ir_ui_menu
msgid "Menu"
msgstr "Menú"

#~ msgid "Menu visibility restriction demo group"
#~ msgstr "Grupo demo de restricción de visibilidad de menús"
30 changes: 30 additions & 0 deletions base_menu_visibility_restriction/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_menu_visibility_restriction
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-31 17:24+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: base_menu_visibility_restriction
#: model:ir.model.fields,field_description:base_menu_visibility_restriction.field_ir_ui_menu__excluded_group_ids
msgid "Excluded Groups"
msgstr "Gruppi esclusi"

#. module: base_menu_visibility_restriction
#: model:ir.model,name:base_menu_visibility_restriction.model_ir_ui_menu
msgid "Menu"
msgstr "Menu"

#~ msgid "Menu visibility restriction demo group"
#~ msgstr "Gruppo demo restrizione visibilità menu"
1 change: 1 addition & 0 deletions base_menu_visibility_restriction/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import ir_ui_menu
26 changes: 26 additions & 0 deletions base_menu_visibility_restriction/models/ir_ui_menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models, tools


class IrUiMenu(models.Model):
_inherit = "ir.ui.menu"

excluded_group_ids = fields.Many2many(
comodel_name="res.groups",
relation="ir_ui_menu_excluded_group_rel",
column1="menu_id",
column2="gid",
string="Excluded Groups",
)

@api.model
@tools.ormcache("frozenset(self.env.user.group_ids.ids)", "debug")
def _visible_menu_ids(self, debug=False):
"""Return the ids of the menu items visible to the user."""
visible = super()._visible_menu_ids(debug=debug)
context = {"ir.ui.menu.full_list": True}
menus = self.with_context(**context).browse(visible)
groups = self.env.user.group_ids
visible = menus - menus.filtered(lambda menu: menu.excluded_group_ids & groups)
return set(visible.ids)
3 changes: 3 additions & 0 deletions base_menu_visibility_restriction/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions base_menu_visibility_restriction/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- Dhara Solanki \<<[email protected]>\>
- Nedas Žilinskas \<<[email protected]>\>
- Maciej Wichowski \<<[email protected]>\>
3 changes: 3 additions & 0 deletions base_menu_visibility_restriction/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This addon lets you assign "excluded groups" to menu items. If a user
belongs to a group that is assigned to a menu item as an excluded group,
the user will not be able to see the menu item.
9 changes: 9 additions & 0 deletions base_menu_visibility_restriction/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
To use this module, you need to:

1. Activate the developer mode
2. Go to *Settings \> Technical \> User interface \> Menu Items*.
3. Search for any menu and edit it.
4. Update "Excluded groups" with one group.
5. Login with a user of that group, and you won't see such menu.

You can try with demo data for the menu Apps \> App Store and user demo.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading