Browse Source

[CHG]Controller Changed

pull/78/head
Sreejith P 7 years ago
parent
commit
71070e66b6
  1. 24
      developer_mode/README.rst
  2. 25
      developer_mode/__init__.py
  3. 28
      developer_mode/__manifest__.py
  4. 23
      developer_mode/controllers/__init__.py
  5. 62
      developer_mode/controllers/main.py
  6. 24
      developer_mode/data/cybro_developer_data.xml
  7. 2
      developer_mode/security/security_data.xml
  8. BIN
      developer_mode/static/description/apps_view.png
  9. BIN
      developer_mode/static/description/apps_view1.png
  10. BIN
      developer_mode/static/description/apps_view2.png
  11. BIN
      developer_mode/static/description/cybro.jpg
  12. 82
      developer_mode/static/description/index.html
  13. BIN
      developer_mode/static/description/recent_updates.png
  14. BIN
      developer_mode/static/description/settings.png
  15. BIN
      developer_mode/static/description/working_db.png
  16. 131
      developer_mode/views/developer_mode_view.xml
  17. 13
      developer_mode/views/web_view.xml

24
developer_mode/README.rst

@ -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

25
developer_mode/__init__.py

@ -1,23 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Nilmar Shereef(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef (<https://www.cybrosys.com>)
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
# 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 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
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
# 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/>.
#
##############################################################################
###################################################################################
from . import controllers

28
developer_mode/__manifest__.py

@ -1,36 +1,34 @@
# -*- coding: utf-8 -*-
##############################################################################
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Nilmar Shereef(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef (<https://www.cybrosys.com>)
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
# 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 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
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
# 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/>.
#
##############################################################################
###################################################################################
{
'name': "Automatic Developer Mode",
'summary': """Automatically Activate Developer Mode & Running DB Name on Left Top""",
'version': '10.0.4.0.0',
'version': '10.0.5.0.0',
'author': 'Cybrosys Techno Solutions',
'website': "http://www.cybrosys.com",
'website': "https://www.cybrosys.com",
'company': 'Cybrosys Techno Solutions',
'category': 'Extra Tools',
'depends': ['base', 'web', 'base_setup'],
'data': [
'views/web_view.xml',
'security/security_data.xml',
'views/developer_mode_view.xml',
'views/ir_rule_view.xml',

23
developer_mode/controllers/__init__.py

@ -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

62
developer_mode/controllers/main.py

@ -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)

24
developer_mode/data/cybro_developer_data.xml

@ -9,24 +9,32 @@
</record>
<record model="res.partner" id="cybro_partner_developer_mode">
<field name="name">Cybrodeveloper</field>
<field name="website">www.cybrosys.com</field>
<field name="name">Cybro Developer</field>
<field name="comment">
******************************************************
Your freelance partner!
Your Odoo ERP Consultant!
******************************************************
Custom development for Odoo is what we do. Talk to us!
Cybrosys provides tremendous scope of Odoo customization where all kinds of business needs can be satisfied and could further enhance later if required with ease. Talk to us!
</field>
<field name="country_id" ref="base.pt"/>
<field name="country_id" ref="base.in"/>
<field name="supplier" eval="True"/>
<field name="customer" eval="False"/>
<field name="customer" eval="True"/>
<field name="street">Kinfra Techno Park </field>
<field name="street2">Neospace</field>
<field name="city">Kakkancherry</field>
<field name="zip">673635</field>
<field name="company_type">673635</field>
<field name="is_company">1</field>
<field name="phone">+91 (0) 4943015006</field>
<field name="mobile">+91 (0) 4943015007</field>
<field name="email">info@cybrsys.com</field>
<field name="website">https://www.cybrosys.com</field>
<field name="image" type="base64" file="developer_mode/static/description/cybro.jpg"/>
</record>
</data>
</odoo>

2
developer_mode/security/security_data.xml

@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="odoo_developer_group" model="res.groups">
<field name="name">Odoo Developer</field>
<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'))]"/>
</record>
</data>
</odoo>

BIN
developer_mode/static/description/apps_view.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

BIN
developer_mode/static/description/apps_view1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
developer_mode/static/description/apps_view2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
developer_mode/static/description/cybro.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

82
developer_mode/static/description/index.html

@ -3,14 +3,16 @@
<div class="oe_span12">
<h2 class="oe_slogan">Automatic Developer Mode</h2>
<h3 class="oe_slogan">Developers, Keep up your smile!</h3>
<h4 class="oe_slogan">Cybrosys Technologies , www.cybrosys.com</h4>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com/">Author: Cybrosys Technologies</a></h4>
</div>
<div class="oe_row oe_spaced">
<h4><p style="margin-left: 41px;">Keep smiling for the below reasons:</p></h4>
<ul>
<li style="list-style:none !important;"><span style="color:green;"> &#9786;</span>&nbsp;&nbsp; Automatically Trigger Developer Mode.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9786;</span>&nbsp;&nbsp; Separate Group for 'Odoo Developers'.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9786;</span>&nbsp;&nbsp; Showing Running DB On Left Top.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9786;</span>&nbsp;&nbsp; Update Modules Easily.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9786;</span>&nbsp;&nbsp; Upgrade Modules Easily.</li>
</ul>
</div>
<div class="oe_span6">
@ -27,16 +29,18 @@
</div>
</section>
<section class="oe_container">
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Configuration</h2>
<div class="oe_span6">
<p class="oe_mt32">
<p>As shown here, Simply automate the developer mode. It helps developer in several perspective. NOTE That, you have to re-login after this module installation</p>
Important Notes: You have to enable 'Odoo Developer' group for respective users (Except Admin)in settings &
YOU HAVE TO RE-LOGIN AFTER THE MODULE INSTALLATION.
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<img src="im_login.jpg">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="settings.png">
</div>
</div>
</div>
@ -46,12 +50,26 @@
<div class="oe_row oe_spaced">
<div class="oe_span6">
<p class="oe_mt32">
<p>The developer can identify running DB easily.</p>
As shown here, Simply automate the developer mode. It helps developer in several perspective.
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<img src="working_db.png">
<img src="im_login.jpg">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Running DB on left Top</h2>
<h3 class="oe_slogan">The developer can identify running DB easily.</h3>
</div>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="apps_view1.png">
</div>
</div>
</div>
@ -59,37 +77,51 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span6">
<p class="oe_mt32">
<p>Easily update any module without opening the module form.</p>
</p>
<div class="oe_span12">
<h2 class="oe_slogan">Simplify Your Clicks</h2>
<h3 class="oe_slogan">Easily upgrade any module without going the module form.</h3>
</div>
<div class="oe_span6">
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="apps_view.png">
<img src="apps_view2.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Recent Upgrades History</h2>
<h3 class="oe_slogan">Recent upgraded filter view in Apps.</h3>
</div>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="recent_updates.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;" href="http://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;"
href="http://www.cybrosys.com/contact/"><i
<div>
<a class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;"
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
<a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://apps.odoo.com/apps/modules/browse?author=Cybrosys%20Techno%20Solutions"><i
class="fa fa-suitcase"></i> Other Cybro Apps</a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
</div>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
</section>

BIN
developer_mode/static/description/recent_updates.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
developer_mode/static/description/settings.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
developer_mode/static/description/working_db.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

131
developer_mode/views/developer_mode_view.xml

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!--Filter view in apps page-->
<record id="view_module_filter" model="ir.ui.view">
<field name="name">ir.module.module.list.select</field>
<field name="inherit_id" ref="base.view_module_filter"/>
@ -19,68 +20,68 @@
</field>
</record>
<record id="developer_mode_module_form" model="ir.ui.view">
<field name="name">ir.module.module.form</field>
<field name="inherit_id" ref="base.module_form"/>
<field name="model">ir.module.module</field>
<field name="arch" type="xml">
<!--<record id="developer_mode_module_form" model="ir.ui.view">-->
<!--<field name="name">ir.module.module.form</field>-->
<!--<field name="inherit_id" ref="base.module_form"/>-->
<!--<field name="model">ir.module.module</field>-->
<!--<field name="arch" type="xml">-->
<xpath expr="//field[@name='dependencies_id']/tree/field[last()]" position="after">
<button name="dt_button_install"
string="Install"
type="object"
icon="STOCK_ADD"
states="uninstalled"
groups="developer_mode.odoo_developer_group"/>
<!--<xpath expr="//field[@name='dependencies_id']/tree/field[last()]" position="after">-->
<!--<button name="dt_button_install"-->
<!--string="Install" -->
<!--type="object"-->
<!--icon="STOCK_ADD"-->
<!--states="uninstalled"-->
<!--groups="developer_mode.odoo_developer_group"/>-->
<button name="dt_button_immediate_upgrade"
string="Update"
type="object"
icon="STOCK_REFRESH"
states="installed"
groups="developer_mode.odoo_developer_group"/>
<!--<button name="dt_button_immediate_upgrade"-->
<!--string="Update" -->
<!--type="object"-->
<!--icon="STOCK_REFRESH"-->
<!--states="installed"-->
<!--groups="developer_mode.odoo_developer_group"/>-->
<button name="dt_button_uninstall"
string="Uninstall"
type="object"
icon="STOCK_STOP"
states="installed"
groups="developer_mode.odoo_developer_group"/>
</xpath>
<!--<button name="dt_button_uninstall"-->
<!--string="Uninstall" -->
<!--type="object"-->
<!--icon="STOCK_STOP"-->
<!--states="installed"-->
<!--groups="developer_mode.odoo_developer_group"/>-->
<!--</xpath>-->
</field>
</record>
<!--</field>-->
<!--</record>-->
<record id="developer_mode_module_module_tree" model="ir.ui.view">
<field name="name">ir.module.module.tree</field>
<field name="inherit_id" ref="base.module_tree"/>
<field name="model">ir.module.module</field>
<field name="arch" type="xml">
<xpath expr="//field[last()]" position="after">
<button name="button_install"
string="Install"
type="object"
icon="STOCK_ADD"
states="uninstalled"
groups="developer_mode.odoo_developer_group"/>
<!--<record id="developer_mode_module_module_tree" model="ir.ui.view">-->
<!--<field name="name">ir.module.module.tree</field>-->
<!--<field name="inherit_id" ref="base.module_tree"/>-->
<!--<field name="model">ir.module.module</field>-->
<!--<field name="arch" type="xml">-->
<!---->
<!--<xpath expr="//field[last()]" position="after">-->
<!--<button name="button_install"-->
<!--string="Install" -->
<!--type="object"-->
<!--icon="STOCK_ADD"-->
<!--states="uninstalled"-->
<!--groups="developer_mode.odoo_developer_group"/>-->
<button name="button_immediate_upgrade"
string="Update"
type="object"
icon="STOCK_REFRESH"
states="installed"
groups="developer_mode.odoo_developer_group"/>
<!--<button name="button_immediate_upgrade"-->
<!--string="Update" -->
<!--type="object"-->
<!--icon="STOCK_REFRESH"-->
<!--states="installed"-->
<!--groups="developer_mode.odoo_developer_group"/>-->
<button name="button_uninstall"
string="Uninstall"
type="object"
icon="STOCK_STOP"
states="installed"
groups="developer_mode.odoo_developer_group"/>
</xpath>
</field>
</record>
<!--<button name="button_uninstall"-->
<!--string="Uninstall" -->
<!--type="object"-->
<!--icon="STOCK_STOP"-->
<!--states="installed"-->
<!--groups="developer_mode.odoo_developer_group"/>-->
<!--</xpath>-->
<!--</field>-->
<!--</record>-->
<record model="ir.ui.view" id="developer_mode_module_view_kanban">
<field name="name">Modules Kanban</field>
@ -93,29 +94,11 @@
</xpath>
</field>
</record>
<!--##############################################################################-->
<!--This code is not necessary in this module.-->
<!--<record id="base.open_module_tree" model="ir.actions.act_window">-->
<!--<field name="name">Local Modules</field>-->
<!--<field name="res_model">ir.module.module</field>-->
<!--<field name="view_type">form</field>-->
<!--<field name="view_mode">kanban,tree,form</field>-->
<!--<field name="context">{'search_default_app':1}</field>-->
<!--<field name="search_view_id" ref="base.view_module_filter"/>-->
<!--<field name="view_id" ref="base.module_view_kanban"/>-->
<!--<field name="help" type="html">-->
<!--<p><b>No module found!</b></p>-->
<!--<p>You should try others search criteria.</p>-->
<!--</field>-->
<!--</record>-->
<!--#################################################################################-->
<template id="contact" inherit_id="web.menu_secondary">
<xpath expr="//span[@class='oe_logo_edit']" position="before">
<t t-if="True" groups="developer_mode.odoo_developer_group">
<div style="height:20px;text-align:center;background-color:green;color:#ffffff;">
<div style="height:20px;text-align:center;background-color:#800070b3;color:#ffffff;">
<t t-esc="request.session.db"/>
</div>
</t>

13
developer_mode/views/web_view.xml

@ -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 '&amp;' or '?')</attribute>
</xpath>
</field>
</record>
</data>
</odoo>
Loading…
Cancel
Save