Browse Source

[ADD] web_developer_mode_optional

Added web_developer_mode_optional module to allow access to developer mode, based on user groups.
Consider this as a substitute and improvement of PR https://github.com/OCA/web/pull/128
Now this allows to show 'developer mode' link only to those users who are in a certain group.
pull/248/head
Alejandro Santana 9 years ago
parent
commit
0d9f34861c
  1. 60
      web_developer_mode_optional/README.rst
  2. 5
      web_developer_mode_optional/__init__.py
  3. 46
      web_developer_mode_optional/__openerp__.py
  4. 21
      web_developer_mode_optional/i18n/ca.po
  5. 21
      web_developer_mode_optional/i18n/es.po
  6. 21
      web_developer_mode_optional/i18n/fr.po
  7. 21
      web_developer_mode_optional/i18n/gl.po
  8. 21
      web_developer_mode_optional/i18n/it.po
  9. 21
      web_developer_mode_optional/i18n/pt.po
  10. 21
      web_developer_mode_optional/i18n/sk.po
  11. 21
      web_developer_mode_optional/i18n/web_developer_mode_optional.pot
  12. 13
      web_developer_mode_optional/security/web_developer_mode_optional_security.xml
  13. BIN
      web_developer_mode_optional/static/description/icon.png
  14. 213
      web_developer_mode_optional/static/description/icon.svg
  15. 43
      web_developer_mode_optional/static/src/js/chrome.js
  16. 13
      web_developer_mode_optional/views/webclient_templates.xml

60
web_developer_mode_optional/README.rst

@ -0,0 +1,60 @@
.. 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
=======================
Developer Mode optional
=======================
This module makes *Developer Mode* link (in the *About Odoo* dialog) visibility optional based on users' groups.
This way, only those users belonging to a specific group will have access to *Developer Mode* link.
Known issues
============
So far, only the link is removed, but debug mode can still be activated via URL.
It would be nice to totally disallow debug mode behaviour.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/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
`here <https://github.com/OCA/web/issues/new?body=module:%20web_developer_mode_optional%0Aversion:%208.0.1.0.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**%0A>`_.
Credits
=======
Contributors
------------
- Alejandro Santana <alejandrosantana@anubia.es>
Font used in icon
-----------------
Module icon was created by Alejandro Santana and includes some icons from
Font Awesome by Dave Gandy - http://fontawesome.io
which is under SIL OFL 1.1 ( http://scripts.sil.org/OFL ) license,
allowing derivative works.
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://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 http://odoo-community.org.

5
web_developer_mode_optional/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
#
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.
#

46
web_developer_mode_optional/__openerp__.py

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) All rights reserved:
# (c) 2015 Anubía, soluciones en la nube,SL (http://www.anubia.es)
# Alejandro Santana <alejandrosantana@anubia.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see http://www.gnu.org/licenses
#
##############################################################################
{
'name': 'Optional Developer Mode link',
'version': '8.0.1.0.0',
'category': 'Generic Modules/Others',
'summary': ('This module adds group-based permissions '
'for the Developer Mode.'),
'author': ('Odoo Community Association (OCA), '
'Alejandro Santana'),
'maintainer': 'Odoo Community Association (OCA)',
'website': 'http://odoo-community.org',
'license': 'AGPL-3',
'depends': [
'web',
],
'data': [
'security/web_developer_mode_optional_security.xml',
'views/webclient_templates.xml',
],
'js': [
'static/src/js/chrome.js',
],
'installable': True,
'application': False,
'auto_install': False,
}

21
web_developer_mode_optional/i18n/ca.po

@ -0,0 +1,21 @@
# Catalan translation.
# This file contains the translation of the following modules:
# * web_developer_mode_optional
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-22 01:26+0000\n"
"PO-Revision-Date: 2015-04-22 01:26+0000\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: web_developer_mode_optional
#: model:res.groups,name:web_developer_mode_optional.group_developer
msgid "Enable developer mode"
msgstr "Activa més modes programador"

21
web_developer_mode_optional/i18n/es.po

@ -0,0 +1,21 @@
# Spanish translation.
# This file contains the translation of the following modules:
# * web_developer_mode_optional
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-22 01:26+0000\n"
"PO-Revision-Date: 2015-04-22 01:26+0000\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: web_developer_mode_optional
#: model:res.groups,name:web_developer_mode_optional.group_developer
msgid "Enable developer mode"
msgstr "Activar el modo desarrollador"

21
web_developer_mode_optional/i18n/fr.po

@ -0,0 +1,21 @@
# French translation.
# This file contains the translation of the following modules:
# * web_developer_mode_optional
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-22 01:26+0000\n"
"PO-Revision-Date: 2015-04-22 01:26+0000\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: web_developer_mode_optional
#: model:res.groups,name:web_developer_mode_optional.group_developer
msgid "Enable developer mode"
msgstr "Activer le mode développeur"

21
web_developer_mode_optional/i18n/gl.po

@ -0,0 +1,21 @@
# Galician translation.
# This file contains the translation of the following modules:
# * web_developer_mode_optional
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-22 01:26+0000\n"
"PO-Revision-Date: 2015-04-22 01:26+0000\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: web_developer_mode_optional
#: model:res.groups,name:web_developer_mode_optional.group_developer
msgid "Enable developer mode"
msgstr "Activar o modo de desenvolvedor"

21
web_developer_mode_optional/i18n/it.po

@ -0,0 +1,21 @@
# Italian translation.
# This file contains the translation of the following modules:
# * web_developer_mode_optional
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-22 01:26+0000\n"
"PO-Revision-Date: 2015-04-22 01:26+0000\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: web_developer_mode_optional
#: model:res.groups,name:web_developer_mode_optional.group_developer
msgid "Enable developer mode"
msgstr "Attiva modalità sviluppatore"

21
web_developer_mode_optional/i18n/pt.po

@ -0,0 +1,21 @@
# Portuguese translation.
# This file contains the translation of the following modules:
# * web_developer_mode_optional
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-22 01:26+0000\n"
"PO-Revision-Date: 2015-04-22 01:26+0000\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: web_developer_mode_optional
#: model:res.groups,name:web_developer_mode_optional.group_developer
msgid "Enable developer mode"
msgstr "Ativar o modo de desenvolvedor"

21
web_developer_mode_optional/i18n/sk.po

@ -0,0 +1,21 @@
# Slovak translation.
# This file contains the translation of the following modules:
# * web_developer_mode_optional
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-22 01:26+0000\n"
"PO-Revision-Date: 2015-04-22 01:26+0000\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: web_developer_mode_optional
#: model:res.groups,name:web_developer_mode_optional.group_developer
msgid "Enable developer mode"
msgstr "Zapnúť režim pre vývojárov"

21
web_developer_mode_optional/i18n/web_developer_mode_optional.pot

@ -0,0 +1,21 @@
# Translation template file.
# This file contains the translation of the following modules:
# * web_developer_mode_optional
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-22 01:26+0000\n"
"PO-Revision-Date: 2015-04-22 01:26+0000\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: web_developer_mode_optional
#: model:res.groups,name:web_developer_mode_optional.group_developer
msgid "Enable developer mode"
msgstr ""

13
web_developer_mode_optional/security/web_developer_mode_optional_security.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<!-- GROUPS -->
<record id="group_developer" model="res.groups">
<field name="name">Enable developer mode</field>
<field name="category_id" ref="base.module_category_hidden"/>
<field name="users" eval="[(4,ref('base.user_root'))]"/>
</record>
</data>
</openerp>

BIN
web_developer_mode_optional/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 4.2 KiB

213
web_developer_mode_optional/static/description/icon.svg
File diff suppressed because it is too large
View File

43
web_developer_mode_optional/static/src/js/chrome.js

@ -0,0 +1,43 @@
// License, author and contributors information in:
// __openerp__.py file at the root folder of this module.
/*---------------------------------------------------------
* OpenERP Web chrome
*---------------------------------------------------------*/
openerp.web_developer_mode_optional = function () {
var instance = openerp;
openerp.web.chrome = {};
var QWeb = instance.web.qweb;
var _t = instance.web._t;
instance.web.UserMenuDevel = instance.web.UserMenu.include({
on_menu_about: function() {
var self = this;
var Users = new openerp.web.Model('res.users');
var debug_mode_enabled = true;
Users.call('has_group', ['web_developer_mode_optional.group_developer'])
.then(function (result) {
debug_mode_enabled = result;
self.rpc("/web/webclient/version_info", {}).done(function (res) {
var $help = $(QWeb.render("UserMenu.about", {version_info: res}));
if (debug_mode_enabled) {
$help.find('a.oe_activate_debug_mode').click(function (e) {
e.preventDefault();
window.location = $.param.querystring( window.location.href, 'debug');
});
} else {
$help.find('a.oe_activate_debug_mode').remove();
}
new instance.web.Dialog(this, {
size: 'medium',
dialogClass: 'oe_act_window',
title: _t("About"),
}, $help).open();
});
});
},
});
}

13
web_developer_mode_optional/views/webclient_templates.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<template id="assets_backend" name="web_developer_mode_optional assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_developer_mode_optional/static/src/js/chrome.js"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save