@ -0,0 +1,24 @@ |
|||||
|
===================================== |
||||
|
Automatic Developer Mode v10 |
||||
|
===================================== |
||||
|
I am a developer. I know our time is very precious. |
||||
|
- Nilmar Shereef |
||||
|
|
||||
|
|
||||
|
Odoo Developers, Keep smiling for the below reasons: |
||||
|
* Automatically Trigger Developer Mode. |
||||
|
* Separate Group for 'Odoo Developers'. |
||||
|
* Showing Running DB On Left Top. |
||||
|
* Upgrade Modules Easily. |
||||
|
* Recently Upgraded Filter. |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* `Nilmar Shereef < shereef@cybsosys.in >`__ |
||||
|
|
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
||||
|
|
||||
|
Tested on Odoo 10.0 ffba5c688ff74a0630f9f70be1d7760a43a7deba |
@ -1,23 +1,22 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
############################################################################## |
################################################################################### |
||||
# |
# |
||||
# Cybrosys Technologies Pvt. Ltd. |
# Cybrosys Technologies Pvt. Ltd. |
||||
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
# Author: Nilmar Shereef(<http://www.cybrosys.com>) |
# Author: Nilmar Shereef (<https://www.cybrosys.com>) |
||||
# you can modify it under the terms of the GNU LESSER |
|
||||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|
||||
# |
# |
||||
# It is forbidden to publish, distribute, sublicense, or sell copies |
# This program is free software: you can modify |
||||
# of the Software or modified copies of the Software. |
# it under the terms of the GNU Affero General Public License (AGPL) 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, |
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
# GNU Affero General Public License for more details. |
||||
# |
# |
||||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
# You should have received a copy of the GNU Affero General Public License |
||||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
# If not, see <http://www.gnu.org/licenses/>. |
|
||||
# |
# |
||||
############################################################################## |
################################################################################### |
||||
|
from . import controllers |
||||
|
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Nilmar Shereef (<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) 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 <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################### |
||||
|
|
||||
|
import main |
@ -0,0 +1,62 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Nilmar Shereef (<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) 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 <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################### |
||||
|
import odoo |
||||
|
from odoo import http, _ |
||||
|
from odoo.http import route |
||||
|
from odoo.http import request |
||||
|
from odoo.addons.web.controllers.main import Home, ensure_db |
||||
|
|
||||
|
|
||||
|
class AutoDeveloperMode(Home): |
||||
|
|
||||
|
@http.route('/web/login', type='http', auth="none") |
||||
|
def web_login(self, redirect=None, **kw): |
||||
|
""" Controller functions overrides for redirecting to developer mode if the logging user is admin or |
||||
|
'Odoo Developer' group member """ |
||||
|
ensure_db() |
||||
|
request.params['login_success'] = False |
||||
|
if request.httprequest.method == 'GET' and redirect and request.session.uid: |
||||
|
return http.redirect_with_hash(redirect) |
||||
|
|
||||
|
if not request.uid: |
||||
|
request.uid = odoo.SUPERUSER_ID |
||||
|
|
||||
|
values = request.params.copy() |
||||
|
try: |
||||
|
values['databases'] = http.db_list() |
||||
|
except odoo.exceptions.AccessDenied: |
||||
|
values['databases'] = None |
||||
|
if request.httprequest.method == 'POST': |
||||
|
old_uid = request.uid |
||||
|
uid = request.session.authenticate(request.session.db, request.params['login'], request.params['password']) |
||||
|
if uid is not False: |
||||
|
request.params['login_success'] = True |
||||
|
if not redirect: |
||||
|
odoo_technician = request.env.user.has_group('developer_mode.odoo_developer_group') |
||||
|
if odoo_technician or request.uid == 1: |
||||
|
redirect = '/web?debug=1' |
||||
|
else: |
||||
|
redirect = '/web' |
||||
|
return http.redirect_with_hash(redirect) |
||||
|
request.uid = old_uid |
||||
|
values['error'] = _("Wrong login/password") |
||||
|
return request.render('web.login', values) |
@ -1,12 +1,10 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<odoo> |
<odoo> |
||||
<data noupdate="1"> |
<data noupdate="1"> |
||||
|
|
||||
<record id="odoo_developer_group" model="res.groups"> |
<record id="odoo_developer_group" model="res.groups"> |
||||
<field name="name">Odoo Developer</field> |
<field name="name">Odoo Developer</field> |
||||
<field name="implied_ids" eval="[(4, ref('base.group_system')),(4, ref('base.group_no_one'))]"/> |
<field name="implied_ids" eval="[(4, ref('base.group_system')),(4, ref('base.group_no_one'))]"/> |
||||
<field name="users" eval="[(4, ref('base.user_root'))]"/> |
<field name="users" eval="[(4, ref('base.user_root'))]"/> |
||||
</record> |
</record> |
||||
|
|
||||
</data> |
</data> |
||||
</odoo> |
</odoo> |
||||
|
Before Width: | Height: | Size: 152 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 50 KiB |
@ -1,13 +0,0 @@ |
|||||
<odoo> |
|
||||
<data> |
|
||||
<record model="ir.ui.view" id="developer_mode_active_form"> |
|
||||
<field name="name">DeveloperMode</field> |
|
||||
<field name="inherit_id" ref="web.login"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<xpath expr="//input[@name='redirect']" position='attributes'> |
|
||||
<attribute name="t-att-value">'%s%sdebug=1' % (redirect or '/web', redirect and '?' in redirect and '&' or '?')</attribute> |
|
||||
</xpath> |
|
||||
</field> |
|
||||
</record> |
|
||||
</data> |
|
||||
</odoo> |
|