cam testenv blue bars (side and top), test background image for standard-frontend and qweb reports
parent
8f3156e2b2
commit
5c6c645b13
|
|
@ -20,5 +20,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import controllers
|
import controllers
|
||||||
|
import report
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ Test Environment
|
||||||
""",
|
""",
|
||||||
'author': 'camadeus Consulting GmbH',
|
'author': 'camadeus Consulting GmbH',
|
||||||
'website': 'http://www.camadeus.at',
|
'website': 'http://www.camadeus.at',
|
||||||
'depends': ['web','base'],
|
'depends': ['report', 'web', 'base'],
|
||||||
'data': [
|
'data': [
|
||||||
'views/cam_testenv.xml',
|
'views/cam_testenv.xml',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -28,8 +28,8 @@ from openerp.addons.web import http
|
||||||
from openerp.addons.web.controllers.main import Home
|
from openerp.addons.web.controllers.main import Home
|
||||||
from openerp.http import request
|
from openerp.http import request
|
||||||
|
|
||||||
class Home_Debug(Home):
|
|
||||||
|
|
||||||
|
class Home_Debug(Home):
|
||||||
@http.route('/', type='http', auth="none")
|
@http.route('/', type='http', auth="none")
|
||||||
def index(self, s_action=None, db=None, **kw):
|
def index(self, s_action=None, db=None, **kw):
|
||||||
|
|
||||||
|
|
@ -39,6 +39,7 @@ class Home_Debug(Home):
|
||||||
else:
|
else:
|
||||||
return http.local_redirect('/web', query=request.params, keep_hash=True)
|
return http.local_redirect('/web', query=request.params, keep_hash=True)
|
||||||
|
|
||||||
|
|
||||||
class WebClient(http.Controller):
|
class WebClient(http.Controller):
|
||||||
_cp_path = "/web/testenv"
|
_cp_path = "/web/testenv"
|
||||||
|
|
||||||
|
|
@ -59,10 +60,8 @@ class WebClient(http.Controller):
|
||||||
pattern_list = [r]
|
pattern_list = [r]
|
||||||
|
|
||||||
for pattern in pattern_list:
|
for pattern in pattern_list:
|
||||||
if isinstance(pattern, str) and re.match(pattern, db):
|
if isinstance(pattern, str) and re.match(pattern, db):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,49 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Odoo Extension Module
|
||||||
|
# Copyright (C) 2014-2016 Camadeus GmbH (<http://www.camadeus.at>)
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
#
|
||||||
|
import re
|
||||||
|
import openerp
|
||||||
|
from openerp import models
|
||||||
|
import logging
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class Report(models.Model):
|
||||||
|
_inherit = "report"
|
||||||
|
|
||||||
|
def render(self, cr, uid, ids, template, values=None, context=None):
|
||||||
|
testmode = {'testmode': False}
|
||||||
|
|
||||||
|
r = openerp.tools.config.get('dbfilter_test', 'test.*')
|
||||||
|
try:
|
||||||
|
pattern_list = eval(r)
|
||||||
|
if not hasattr(pattern_list, '__iter__'):
|
||||||
|
pattern_list = [pattern_list]
|
||||||
|
except:
|
||||||
|
pattern_list = [r]
|
||||||
|
|
||||||
|
for pattern in pattern_list:
|
||||||
|
if isinstance(pattern, str) and re.match(pattern, cr.dbname):
|
||||||
|
testmode = {'testmode': True}
|
||||||
|
_logger.info('testmode enabled for reports')
|
||||||
|
|
||||||
|
if not values:
|
||||||
|
values = {}
|
||||||
|
values.update(testmode)
|
||||||
|
return super(Report, self).render(cr, uid, ids, template, values, context)
|
||||||
|
|
@ -1,10 +1,20 @@
|
||||||
|
.test-mode-activated .oe_view_manager_wrapper {
|
||||||
.test-mode-activated {
|
background-image: url("/cam_testenv/static/src/img/back-testenv.jpg");
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-attachment: fixed;
|
background-attachment: fixed;
|
||||||
|
}
|
||||||
|
.test-mode-activated .oe_view_manager_body,
|
||||||
|
.test-mode-activated .oe_view_manager_wrapper > * {
|
||||||
|
opacity: 0.9;
|
||||||
|
background: rgba(255,255,255,.8) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.test-mode-activated > * {
|
.test-mode-activated .oe_list_field {
|
||||||
opacity: 0.9;
|
opacity: 1;
|
||||||
background-color: rgba(0,0,0,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.test-mode-activated .oe_leftbar > * ,
|
||||||
|
.test-mode-activated .oe_view_manager_header > *{
|
||||||
|
background: lightblue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="210mm"
|
||||||
|
height="297mm"
|
||||||
|
viewBox="0 0 744.09448819 1052.3622047"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="print_test.svg">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="0.35"
|
||||||
|
inkscape:cx="-320.71429"
|
||||||
|
inkscape:cy="634.28571"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:snap-text-baseline="false"
|
||||||
|
inkscape:window-width="1863"
|
||||||
|
inkscape:window-height="1176"
|
||||||
|
inkscape:window-x="57"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Ebene 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1">
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:334.50509644px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:0.20114942;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
|
||||||
|
x="-541.57294"
|
||||||
|
y="739.65405"
|
||||||
|
id="text3336"
|
||||||
|
sodipodi:linespacing="125%"
|
||||||
|
transform="matrix(0.57726416,-0.80650188,0.81188871,0.59801083,0,0)"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan3338"
|
||||||
|
x="-541.57294"
|
||||||
|
y="739.65405">Test</tspan></text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="200mm"
|
||||||
|
height="234mm"
|
||||||
|
viewBox="0 0 708.66142 829.13385"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="print_test_n.svg">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="0.35"
|
||||||
|
inkscape:cx="-320.71429"
|
||||||
|
inkscape:cy="634.28571"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:snap-text-baseline="false"
|
||||||
|
inkscape:window-width="1863"
|
||||||
|
inkscape:window-height="1176"
|
||||||
|
inkscape:window-x="57"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Ebene 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-223.22835)">
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:252.86198425px;line-height:125%;font-family:'Arial Black';-inkscape-font-specification:'Arial Black, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#dddddf;fill-opacity:0.94117647;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
x="-639.02655"
|
||||||
|
y="739.08575"
|
||||||
|
id="text3336"
|
||||||
|
sodipodi:linespacing="125%"
|
||||||
|
transform="matrix(0.55246707,-0.84270113,0.77701305,0.62485212,0,0)"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan3338"
|
||||||
|
x="-639.02655"
|
||||||
|
y="739.08575">TEST</tspan></text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.4 KiB |
|
|
@ -21,7 +21,7 @@ openerp.cam_testenv = function (openerp) {
|
||||||
// (should not change, but just in case...)
|
// (should not change, but just in case...)
|
||||||
if (result) {
|
if (result) {
|
||||||
$("body").addClass("test-mode-activated");
|
$("body").addClass("test-mode-activated");
|
||||||
$("body").css("background-image", "url(" + openerp.session.origin + "/cam_testenv/static/src/img/back-testenv.jpg" + ")");
|
// $("body").css("background-image", "url(" + openerp.session.origin + "/cam_testenv/static/src/img/back-testenv.jpg" + ")");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,34 @@
|
||||||
<script type="text/javascript" src="/cam_testenv/static/src/js/testenv.js"></script>
|
<script type="text/javascript" src="/cam_testenv/static/src/js/testenv.js"></script>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template id="report.style">
|
||||||
|
body {
|
||||||
|
color: #000 !important;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
.border-black td {
|
||||||
|
border-top: 1px solid black !important;
|
||||||
|
}
|
||||||
|
.table-condensed > thead > tr > th {
|
||||||
|
border-bottom: 1px solid black !important;
|
||||||
|
}
|
||||||
|
.table-condensed > tbody > tr {
|
||||||
|
page-break-inside: avoid !important;
|
||||||
|
}
|
||||||
|
.zero_min_height {
|
||||||
|
min-height: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
<t t-if="testmode">
|
||||||
|
div.page {
|
||||||
|
background-image: url("/cam_testenv/static/src/img/print_test_n.svg") !important;
|
||||||
|
background-repeat: repeat-y;
|
||||||
|
background-size: contain;
|
||||||
|
background-position: center center;
|
||||||
|
min-height: 234mm;
|
||||||
|
}
|
||||||
|
</t>
|
||||||
|
</template>
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue