diff --git a/ext/custom-addons/cam_testenv/__init__.py b/ext/custom-addons/cam_testenv/__init__.py index b0f2271d..601f4302 100644 --- a/ext/custom-addons/cam_testenv/__init__.py +++ b/ext/custom-addons/cam_testenv/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 20014-2016 Camadeus GmbH (). # # This program is free software: you can redistribute it and/or modify @@ -20,5 +20,7 @@ ############################################################################## import controllers +import report + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/ext/custom-addons/cam_testenv/__openerp__.py b/ext/custom-addons/cam_testenv/__openerp__.py index 14c44a21..d54d10d2 100644 --- a/ext/custom-addons/cam_testenv/__openerp__.py +++ b/ext/custom-addons/cam_testenv/__openerp__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 20014-2016 Camadeus GmbH (). # # This program is free software: you can redistribute it and/or modify @@ -33,7 +33,7 @@ Test Environment """, 'author': 'camadeus Consulting GmbH', 'website': 'http://www.camadeus.at', - 'depends': ['web','base'], + 'depends': ['report', 'web', 'base'], 'data': [ 'views/cam_testenv.xml', ], diff --git a/ext/custom-addons/cam_testenv/background.xcf b/ext/custom-addons/cam_testenv/background.xcf index eb98e7b8..1af5fe07 100644 Binary files a/ext/custom-addons/cam_testenv/background.xcf and b/ext/custom-addons/cam_testenv/background.xcf differ diff --git a/ext/custom-addons/cam_testenv/controllers/__init__.py b/ext/custom-addons/cam_testenv/controllers/__init__.py index a4e03b1d..23f15e7e 100644 --- a/ext/custom-addons/cam_testenv/controllers/__init__.py +++ b/ext/custom-addons/cam_testenv/controllers/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 20014-2016 Camadeus GmbH (). # # This program is free software: you can redistribute it and/or modify diff --git a/ext/custom-addons/cam_testenv/controllers/testenv_controller.py b/ext/custom-addons/cam_testenv/controllers/testenv_controller.py index 572d8896..3be243a6 100644 --- a/ext/custom-addons/cam_testenv/controllers/testenv_controller.py +++ b/ext/custom-addons/cam_testenv/controllers/testenv_controller.py @@ -28,28 +28,29 @@ from openerp.addons.web import http from openerp.addons.web.controllers.main import Home from openerp.http import request -class Home_Debug(Home): +class Home_Debug(Home): @http.route('/', type='http', auth="none") def index(self, s_action=None, db=None, **kw): - + # Check arguments if openerp.tools.config.get('show_debug', False): return http.local_redirect('/web?debug=1', query=request.params, keep_hash=True) else: return http.local_redirect('/web', query=request.params, keep_hash=True) + class WebClient(http.Controller): _cp_path = "/web/testenv" @http.jsonrequest - def testmode(self, req, db=False): + def testmode(self, req, db=False): if not db and req and req.session: db = req.session._db - + if db: h = req.httprequest.environ['HTTP_HOST'].split(':')[0] - d = h.split('.')[0] + d = h.split('.')[0] r = openerp.tools.config.get('dbfilter_test', 'test.*').replace('%h', h).replace('%d', d) try: pattern_list = eval(r) @@ -57,12 +58,10 @@ class WebClient(http.Controller): pattern_list = [pattern_list] except: pattern_list = [r] - + 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 False - - # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/ext/custom-addons/cam_testenv/print_background.xcf b/ext/custom-addons/cam_testenv/print_background.xcf new file mode 100644 index 00000000..909ca4b5 Binary files /dev/null and b/ext/custom-addons/cam_testenv/print_background.xcf differ diff --git a/ext/custom-addons/cam_testenv/report.py b/ext/custom-addons/cam_testenv/report.py new file mode 100644 index 00000000..c422d85c --- /dev/null +++ b/ext/custom-addons/cam_testenv/report.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# +# Odoo Extension Module +# Copyright (C) 2014-2016 Camadeus GmbH () +# +# 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 . +# +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) diff --git a/ext/custom-addons/cam_testenv/static/src/css/testenv.css b/ext/custom-addons/cam_testenv/static/src/css/testenv.css index 733c3f8c..a36790a4 100644 --- a/ext/custom-addons/cam_testenv/static/src/css/testenv.css +++ b/ext/custom-addons/cam_testenv/static/src/css/testenv.css @@ -1,10 +1,20 @@ - -.test-mode-activated { - background-size: cover; - background-attachment: fixed; +.test-mode-activated .oe_view_manager_wrapper { +background-image: url("/cam_testenv/static/src/img/back-testenv.jpg"); +background-size: cover; +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 .oe_list_field { +opacity: 1; +} + +.test-mode-activated .oe_leftbar > * , +.test-mode-activated .oe_view_manager_header > *{ +background: lightblue; } -.test-mode-activated > * { - opacity: 0.9; - background-color: rgba(0,0,0,0); -} \ No newline at end of file diff --git a/ext/custom-addons/cam_testenv/static/src/img/print_background.png b/ext/custom-addons/cam_testenv/static/src/img/print_background.png new file mode 100644 index 00000000..6c9324dc Binary files /dev/null and b/ext/custom-addons/cam_testenv/static/src/img/print_background.png differ diff --git a/ext/custom-addons/cam_testenv/static/src/img/print_test_inkscape.svg b/ext/custom-addons/cam_testenv/static/src/img/print_test_inkscape.svg new file mode 100644 index 00000000..fd571e9c --- /dev/null +++ b/ext/custom-addons/cam_testenv/static/src/img/print_test_inkscape.svg @@ -0,0 +1,69 @@ + + + + + + + + + + image/svg+xml + + + + + + + Test + + diff --git a/ext/custom-addons/cam_testenv/static/src/img/print_test_n.svg b/ext/custom-addons/cam_testenv/static/src/img/print_test_n.svg new file mode 100644 index 00000000..b0784b5d --- /dev/null +++ b/ext/custom-addons/cam_testenv/static/src/img/print_test_n.svg @@ -0,0 +1,70 @@ + + + + + + + + + + image/svg+xml + + + + + + + TEST + + diff --git a/ext/custom-addons/cam_testenv/static/src/js/testenv.js b/ext/custom-addons/cam_testenv/static/src/js/testenv.js index e47184c5..5e631572 100644 --- a/ext/custom-addons/cam_testenv/static/src/js/testenv.js +++ b/ext/custom-addons/cam_testenv/static/src/js/testenv.js @@ -21,7 +21,7 @@ openerp.cam_testenv = function (openerp) { // (should not change, but just in case...) if (result) { $("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" + ")"); } }); }); diff --git a/ext/custom-addons/cam_testenv/views/cam_testenv.xml b/ext/custom-addons/cam_testenv/views/cam_testenv.xml index f0e25814..fef19f79 100644 --- a/ext/custom-addons/cam_testenv/views/cam_testenv.xml +++ b/ext/custom-addons/cam_testenv/views/cam_testenv.xml @@ -9,5 +9,34 @@ + +