Skip to content

Commit

Permalink
Merge pull request #355 from itpp-labs/17.0-access_settings_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
itpp-bot authored Dec 18, 2023
2 parents 5ff26f1 + 18e176b commit dcb0b3e
Show file tree
Hide file tree
Showing 15 changed files with 233 additions and 0 deletions.
18 changes: 18 additions & 0 deletions access_settings_menu/README.rst
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>`_
1 change: 1 addition & 0 deletions access_settings_menu/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions access_settings_menu/__manifest__.py
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,
}
20 changes: 20 additions & 0 deletions access_settings_menu/doc/changelog.rst
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
33 changes: 33 additions & 0 deletions access_settings_menu/doc/index.rst
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.
25 changes: 25 additions & 0 deletions access_settings_menu/i18n/access_settings_menu.pot
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 ""

30 changes: 30 additions & 0 deletions access_settings_menu/i18n/de.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:
# * 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"
31 changes: 31 additions & 0 deletions access_settings_menu/i18n/es_CR.po
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"
Binary file added access_settings_menu/images/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions access_settings_menu/models.py
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 access_settings_menu/security/access_settings_menu_security.xml
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>
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>
Binary file added access_settings_menu/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions access_settings_menu/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_fields_view_get
20 changes: 20 additions & 0 deletions access_settings_menu/tests/test_fields_view_get.py
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)

0 comments on commit dcb0b3e

Please sign in to comment.