-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #355 from itpp-labs/17.0-access_settings_menu
commit is created by 👷♂️ Merge Bot: https://odoo-devops.readthedocs.io/en/latest/git/github-merge-bot.html
- Loading branch information
Showing
15 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.. image:: https://itpp.dev/images/infinity-readme.png | ||
:alt: Tested and maintained by IT Projects Labs | ||
:target: https://itpp.dev | ||
|
||
Show settings menu for non-admin | ||
================================ | ||
|
||
Adds "Show Settings Menu" checkbox in user's access rights tab. | ||
|
||
Uninstallation | ||
============== | ||
|
||
After uninstalling, you need to update ``base`` module to return restriction to ``Settings`` menu back. | ||
|
||
Further information | ||
=================== | ||
|
||
Tested on `Odoo 17.0 <https://github.com/odoo/odoo/commit/40b19d89846303016098840f4958fe7cc105067c>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "Show settings menu for non-admin", | ||
"summary": """Allows to make Settings menu visible for non-admins""", | ||
"version": "17.0.2.0.0", | ||
"author": "IT-Projects LLC, Ivan Yelizariev", | ||
"category": "Extra Tools", | ||
"images": ["images/banner.png"], | ||
"support": "[email protected]", | ||
"website": "https://twitter.com/OdooFree", | ||
"license": "Other OSI approved licence", # MIT | ||
"depends": ["access_restricted"], | ||
"data": ["security/access_settings_menu_security.xml"], | ||
"demo": ["security/access_settings_menu_security_demo.xml"], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
`2.0.0` | ||
------- | ||
|
||
- Improvement: replace `access_apps` dependency with `access_restricted` since only the latter one is needed | ||
|
||
`1.0.2` | ||
------- | ||
|
||
- FIX: make compatible with CI-tests of other modules | ||
|
||
|
||
`1.0.1` | ||
------- | ||
|
||
- FIX issue occured when user has ``[x] Show Settings Menu`` access, but doesn't have administration rights | ||
|
||
`1.0.0` | ||
------- | ||
|
||
- Init version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
====================== | ||
Access settings menu | ||
====================== | ||
|
||
Installation | ||
============ | ||
|
||
* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way | ||
|
||
Configuration | ||
============= | ||
|
||
* Open menu ``[[ Settings ]] >> Users & Companies >> Users`` | ||
* Open user form view (click on the line with the user) | ||
* Click ``[Edit]`` | ||
* Select ``[Show Settings Menu]`` and click ``[Save]`` | ||
|
||
Usage | ||
===== | ||
|
||
Without this module installed: | ||
|
||
* Non-admin user can't see the ``[[ Settings ]]`` menu. | ||
|
||
|
||
With this module installed: | ||
|
||
* If non-admin user has the ``[Show Settings Menu]`` right he can see the ``[[ Settings ]]`` menu. | ||
|
||
Uninstallation | ||
============== | ||
|
||
After uninstalling, you need to update ``base`` module to return restriction to ``Settings`` menu back. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * access_settings_menu | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.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: access_settings_menu | ||
#: model:res.groups,name:access_settings_menu.group_show_settings_menu | ||
msgid "Show Settings Menu" | ||
msgstr "" | ||
|
||
#. module: access_settings_menu | ||
#: model:ir.model,name:access_settings_menu.model_res_users | ||
msgid "Users" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
# * access_settings_menu | ||
# | ||
# Translators: | ||
# Sergej Briesin <[email protected]>, 2018 | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2018-04-21 00:17+0000\n" | ||
"PO-Revision-Date: 2018-04-21 00:17+0000\n" | ||
"Last-Translator: Sergej Briesin <[email protected]>, 2018\n" | ||
"Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/" | ||
"de/)\n" | ||
"Language: de\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" | ||
|
||
#. module: access_settings_menu | ||
#: model:res.groups,name:access_settings_menu.group_show_settings_menu | ||
msgid "Show Settings Menu" | ||
msgstr "Einstellungsmenü anzeigen" | ||
|
||
#. module: access_settings_menu | ||
#: model:ir.model,name:access_settings_menu.model_res_users | ||
msgid "Users" | ||
msgstr "Nutzer" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * access_settings_menu | ||
# | ||
# Translators: | ||
# Randall <[email protected]>, 2018 | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2018-04-21 00:17+0000\n" | ||
"PO-Revision-Date: 2017-11-28 13:02+0000\n" | ||
"Last-Translator: Randall <[email protected]>, 2018\n" | ||
"Language-Team: Spanish (Costa Rica) (https://www.transifex.com/it-projects-" | ||
"llc/teams/76080/es_CR/)\n" | ||
"Language: es_CR\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" | ||
|
||
#. module: access_settings_menu | ||
#: model:res.groups,name:access_settings_menu.group_show_settings_menu | ||
msgid "Show Settings Menu" | ||
msgstr "Mostrar Menu de Ajustes" | ||
|
||
#. module: access_settings_menu | ||
#: model:ir.model,name:access_settings_menu.model_res_users | ||
msgid "Users" | ||
msgstr "Usuarios" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from odoo import api, models | ||
|
||
|
||
class ResUsers(models.Model): | ||
_inherit = "res.users" | ||
|
||
@api.model | ||
def fields_get(self, *args, **kwargs): | ||
# switch to superuser to get access to virtual fields | ||
return super(ResUsers, self.sudo()).fields_get(*args, **kwargs) |
20 changes: 20 additions & 0 deletions
20
access_settings_menu/security/access_settings_menu_security.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<!-- Show Settings Menu --> | ||
<record id="group_show_settings_menu" model="res.groups"> | ||
<field name="name">Show Settings Menu</field> | ||
<field name="users" eval="[(4, ref('base.user_root'))]" /> | ||
</record> | ||
<record model="ir.ui.menu" id="base.menu_administration"> | ||
<field | ||
name="groups_id" | ||
eval="[(6,0, [ref('access_settings_menu.group_show_settings_menu')])]" | ||
/> | ||
</record> | ||
<record model="res.groups" id="base.group_erp_manager"> | ||
<field | ||
name="implied_ids" | ||
eval="[(4, ref('access_settings_menu.group_show_settings_menu'))]" | ||
/> | ||
</record> | ||
</odoo> |
9 changes: 9 additions & 0 deletions
9
access_settings_menu/security/access_settings_menu_security_demo.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> | ||
License MIT (https://opensource.org/licenses/MIT). --> | ||
<odoo> | ||
<!-- Grant access to Demo User to don't break CI of other modules --> | ||
<record id="group_show_settings_menu" model="res.groups"> | ||
<field name="users" eval="[(4, ref('base.user_demo'))]" /> | ||
</record> | ||
</odoo> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_fields_view_get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from odoo.tests import common | ||
|
||
from odoo.addons.access_restricted.tests.test_fields_view_get import ( | ||
TestFieldsViewGet as TestFieldsViewGetBase, | ||
) | ||
|
||
|
||
@common.tagged("post_install", "-at_install") | ||
class TestFieldsViewGet(TestFieldsViewGetBase): | ||
def test_access_settings_menu(self): | ||
admin = self.env.ref("base.user_root") | ||
demo = self.env.ref("base.user_demo") | ||
|
||
# demo doesn't have admin rights, but has "Show Settings Menu" | ||
self.clear_access(demo) | ||
self.add_access(demo, "access_settings_menu.group_show_settings_menu") | ||
self.view_form_all(demo) | ||
self.view_form_mix(admin, demo) | ||
self.clear_config() | ||
self.view_form_mix(demo, admin) |