diff --git a/base_technical_features/README.rst b/base_technical_features/README.rst new file mode 100644 index 000000000..1d35fb35e --- /dev/null +++ b/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 +`_. 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 +`_. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Stefan Rijnhart + +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. diff --git a/base_technical_features/__init__.py b/base_technical_features/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/base_technical_features/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/base_technical_features/__openerp__.py b/base_technical_features/__openerp__.py new file mode 100644 index 000000000..c1f95a49b --- /dev/null +++ b/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, +} diff --git a/base_technical_features/models/__init__.py b/base_technical_features/models/__init__.py new file mode 100644 index 000000000..fdb358a01 --- /dev/null +++ b/base_technical_features/models/__init__.py @@ -0,0 +1,2 @@ +from . import basemodel +from . import ir_ui_menu diff --git a/base_technical_features/models/basemodel.py b/base_technical_features/models/basemodel.py new file mode 100644 index 000000000..9712b723f --- /dev/null +++ b/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 diff --git a/base_technical_features/models/ir_ui_menu.py b/base_technical_features/models/ir_ui_menu.py new file mode 100644 index 000000000..878507fca --- /dev/null +++ b/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) diff --git a/base_technical_features/security/res_groups.xml b/base_technical_features/security/res_groups.xml new file mode 100644 index 000000000..d61ffc5c5 --- /dev/null +++ b/base_technical_features/security/res_groups.xml @@ -0,0 +1,8 @@ + + + + Technical Features (w/o debug mode) + + + + diff --git a/base_technical_features/static/description/icon.png b/base_technical_features/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/base_technical_features/static/description/icon.png differ