Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server_mode/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
##############################################################################
{
'name': 'Server Mode',
'version': '8.0.0.1.3',
'version': '8.0.0.2.0',
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
'license': 'AGPL-3',
Expand Down
17 changes: 17 additions & 0 deletions server_mode/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
##############################################################################
from openerp.addons.web import http
from openerp.addons.server_mode import mode as custom_mode
from openerp.addons.web.controllers.main import Home
import openerp.tools as tools
from openerp.http import request
from openerp import http
from random import choice
openerpweb = http


Expand All @@ -17,4 +22,16 @@ def get_mode(self, req, db=False):
return custom_mode.get_mode().upper()
return False


# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
#
class Mode_Server(Home):

@http.route('/web/login', type='http', auth="none")
def web_login(self, redirect=None, **kw):
modet = tools.config.get('server_mode')
if modet:
request.params['mode'] = modet.upper()

return super(Mode_Server, self).web_login(**kw)

37 changes: 37 additions & 0 deletions server_mode/migrations/8.0.0.2.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- encoding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.modules.registry import RegistryManager


def migrate(cr, version):
print 'Migrating product_uom_prices'
if not version:
return
# registry = RegistryManager.get(cr.dbname)
if module_is_installed(cr, 'website'):
install_module(cr, 'website_server_mode')


def module_is_installed(cr, module):
registry = RegistryManager.get(cr.dbname)
model = registry['ir.module.module']
module_ids = model.search(
cr, SUPERUSER_ID,
[('name', '=', module), ('state', '=', 'installed')], {})
if module_ids:
return True
else:
return False


def install_module(cr, module):
registry = RegistryManager.get(cr.dbname)
model = registry['ir.module.module']
module_ids = model.search(
cr, SUPERUSER_ID,
[('name', '=', module)], {})
print 'install module %s' % module
print 'ids for module: %s' % module_ids
model.button_install(
cr, SUPERUSER_ID, module_ids, {})
print 'module installed'
19 changes: 15 additions & 4 deletions server_mode/oerp_develope_js.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@
<openerp>
<data>

<!--<template id="server_mode" name="server_mode assets" inherit_id="web.assets_backend">-->

<template id="server_mode" name="server_mode assets" inherit_id="web.layout">
<xpath expr="." position="inside">
<script type="text/javascript" src="/server_mode/static/src/js/chrome.js"></script>
<!-- Load css for ribbons -->
<link rel="stylesheet" href="/server_mode/static/src/css/ribbon.css"/>
<!-- Load css for ribbons -->
<link rel="stylesheet" href="/server_mode/static/src/css/ribbon.css"/>
</xpath>

<xpath expr="//body" position='after'>
<t t-if="mode">
<div class="test-ribbon"><b><span class="mode_message"> <t t-raw="mode"/> </span></b></div>
</t>
</xpath>

</template>







</data>
</openerp>
6 changes: 3 additions & 3 deletions server_mode/static/src/css/ribbon.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.test-ribbon{
width: 200px;
width: 250px;
background: #e43;
position: absolute;
top: 50px;
left: -50px;
top: 40px;
left: -60px;
text-align: center;
line-height: 50px;
letter-spacing: 1px;
Expand Down
6 changes: 6 additions & 0 deletions website_server_mode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################

49 changes: 49 additions & 0 deletions website_server_mode/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# 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': 'Website Server Mode',
'version': '8.0.0.1.3',
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
'license': 'AGPL-3',
"category": "GenericModules",
'sequence': 10,
'description': """
Website Server Mode
===================
Link bewteen server_mode and website modules
""",
'images': [],
'depends': [
"server_mode",
"website",
],
'data': [
"oerp_wb_develope_js.xml",
],
'demo': [],
'test': [],
'installable': True,
'auto_install': True,
'application': False,
'qweb': [],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
23 changes: 23 additions & 0 deletions website_server_mode/oerp_wb_develope_js.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>


<template id="server_mode_website" name="server_mode assets" inherit_id="website.layout">
<xpath expr="." position="inside">
<script type="text/javascript" src="/server_mode/static/src/js/chrome.js"></script>
<!-- Load css for ribbons -->
<link rel="stylesheet" href="/server_mode/static/src/css/ribbon.css"/>
</xpath>

<xpath expr="//body" position='after'>
<t t-if="mode">
<div class="test-ribbon"><b><span class="mode_message"> <t t-raw="mode"/> </span></b></div>
</t>
</xpath>

</template>


</data>
</openerp>