Browse Source

[ADD] Persistent technical features

pull/321/head
Stefan Rijnhart 9 years ago
parent
commit
f9b1ea2a62
  1. 73
      base_technical_features/README.rst
  2. 1
      base_technical_features/__init__.py
  3. 16
      base_technical_features/__openerp__.py
  4. 2
      base_technical_features/models/__init__.py
  5. 18
      base_technical_features/models/basemodel.py
  6. 16
      base_technical_features/models/ir_ui_menu.py
  7. 8
      base_technical_features/security/res_groups.xml
  8. BIN
      base_technical_features/static/description/icon.png

73
base_technical_features/README.rst

@ -0,0 +1,73 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
==========================================================
Access to technical features without activating debug mode
==========================================================
In Odoo 9.0, the debug mode grants every employee user access to the technical
features. This module enables persistent access to technical features based on
group access.
Configuration
=============
After installation of this module, every employee can still access technical
features for the applications that they have access to by enabling debug mode.
Additionally, users can be assigned the *Technical feature (w/o debug mode)*
access right on their user form which will enable technical features at any
time. As an Odoo administrator, you might want to review who to grant this
access to.
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/9.0
Known issues / Roadmap
======================
* As technical features is not a matter of privileges but of cosmetics, it might be nice to have this as a user configurable preference.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/
server-tools/issues/new?body=module:%20
base_technical_features%0Aversion:%20
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Stefan Rijnhart <stefan@opener.am>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
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.
To contribute to this module, please visit https://odoo-community.org.

1
base_technical_features/__init__.py

@ -0,0 +1 @@
from . import models

16
base_technical_features/__openerp__.py

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# © 2016 Opener B.V.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Technical features group",
"summary": "Access to technical features without activating debug mode",
"version": "8.0.1.0.0",
"category": "Usability",
"website": "https://odoo-community.org/",
"author": "Opener B.V., Odoo Community Association (OCA)",
"data": [
'security/res_groups.xml',
],
"license": "AGPL-3",
"installable": True,
}

2
base_technical_features/models/__init__.py

@ -0,0 +1,2 @@
from . import basemodel
from . import ir_ui_menu

18
base_technical_features/models/basemodel.py

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from openerp.models import BaseModel
BaseModel.base_technical_features_user_has_groups = BaseModel.user_has_groups
def user_has_groups(self, cr, uid, groups, context=None):
""" Return True for users in the technical features group when membership
of this group is checked, even if debug mode is not enabled.
"""
if ('base.group_no_one' in groups.split(',') and
self.pool['res.users'].has_group(
cr, uid, 'base_technical_features.group_technical_features')):
return True
return self.base_technical_features_user_has_groups(
cr, uid, groups, context=context)
BaseModel.user_has_groups = user_has_groups

16
base_technical_features/models/ir_ui_menu.py

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from openerp import api, models
class IrUiMenu(models.Model):
_inherit = 'ir.ui.menu'
@api.model
def _visible_menu_ids(self, debug=False):
""" Set debug = True, so that group_no_one is not filtered out of the
user's groups """
if not debug:
debug = self.pool['res.users'].has_group(
self.env.cr, self.env.uid,
'base_technical_features.group_technical_features')
return super(IrUiMenu, self)._visible_menu_ids(debug=debug)

8
base_technical_features/security/res_groups.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="res.groups" id="group_technical_features">
<field name="name">Technical Features (w/o debug mode)</field>
<field name="implied_ids" eval="[(4, ref('base.group_no_one'))]" />
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
</odoo>

BIN
base_technical_features/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

Loading…
Cancel
Save