diff --git a/addons/report/controllers/main.py b/addons/report/controllers/main.py index 7be790f2ccf..7f72097b68d 100644 --- a/addons/report/controllers/main.py +++ b/addons/report/controllers/main.py @@ -28,22 +28,21 @@ class ReportController(Controller): if docids: docids = [int(i) for i in docids.split(',')] - options_data = None if data.get('options'): - options_data = simplejson.loads(data['options']) + data['options'] = simplejson.loads(data['options']) if data.get('context'): # Ignore 'lang' here, because the context in data is the one from the webclient *but* if - # the user explicitely wants to change the lang, this mechanism overwrites it. - data_context = simplejson.loads(data['context']) - if data_context.get('lang'): - del data_context['lang'] - context.update(data_context) + # the user explicitely wants to change the lang, this mechanism overwrites it. + data['context'] = simplejson.loads(data['context']) + if data['context'].get('lang'): + del data['context']['lang'] + context.update(data['context']) if converter == 'html': - html = report_obj.get_html(cr, uid, docids, reportname, data=options_data, context=context) + html = report_obj.get_html(cr, uid, docids, reportname, data=data, context=context) return request.make_response(html) elif converter == 'pdf': - pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context) + pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=data, context=context) pdfhttpheaders = [('Content-Type', 'application/pdf'), ('Content-Length', len(pdf))] return request.make_response(pdf, headers=pdfhttpheaders) else: diff --git a/addons/report/models/report.py b/addons/report/models/report.py index a6da089263c..6801cf3bdd9 100644 --- a/addons/report/models/report.py +++ b/addons/report/models/report.py @@ -120,6 +120,7 @@ class Report(osv.Model): if request.website is not None: website = request.website context = dict(context, translatable=context.get('lang') != request.website.default_lang_code) + values.update( time=time, context_timestamp=lambda t: fields.datetime.context_timestamp(cr, uid, t, context), diff --git a/addons/report/static/src/css/report.css b/addons/report/static/src/css/report.css new file mode 100644 index 00000000000..c1ba5901d71 --- /dev/null +++ b/addons/report/static/src/css/report.css @@ -0,0 +1,33 @@ +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; +} +.zero_min_height { + min-height: 0px !important; +} + +/* To avoid broken snippets in report rendering */ +.jumbotron, .panel, .carousel, section{ + page-break-inside: avoid; +} +/* Wkhtmltopdf don't support very well the media-print CSS (depends on the version) */ +.hidden-print{ + display: none; +} + +.o_editable:not(:empty)[data-oe-model="ir.ui.view"]:hover, +.o_editable:not(:empty)[data-oe-model="ir.ui.view"] th:hover, +.o_editable:not(:empty)[data-oe-model="ir.ui.view"] td:hover, +.o_editable[data-oe-type][data-oe-model="ir.ui.view"]:hover, +.o_editable[data-oe-type][data-oe-model="ir.ui.view"] th:hover, +.o_editable[data-oe-type][data-oe-model="ir.ui.view"] td:hover { + -moz-box-shadow: #DDCC33 0 0 5px 2px inset; + -webkit-box-shadow: #DDCC33 0 0 5px 2px inset; + box-shadow: #DDCC33 0 0 5px 2px inset; +} diff --git a/addons/report/static/src/js/qwebactionmanager.js b/addons/report/static/src/js/qwebactionmanager.js index 825ac47030a..1f7084aecd7 100644 --- a/addons/report/static/src/js/qwebactionmanager.js +++ b/addons/report/static/src/js/qwebactionmanager.js @@ -52,10 +52,11 @@ ActionManager.include({ // particular: query string of action.data.form and context if (!('data' in action) || !(action.data)) { if ('active_ids' in action.context) { - report_url += "/" + action.context.active_ids.join(','); + report_url += "/" + action.context.active_ids.join(',') + "?enable_editor=1"; } } else { - report_url += "?options=" + encodeURIComponent(JSON.stringify(action.data)); + report_url += "?enable_editor=1"; + report_url += "&options=" + encodeURIComponent(JSON.stringify(action.data)); report_url += "&context=" + encodeURIComponent(JSON.stringify(action.context)); } diff --git a/addons/report/static/src/js/report.editor.js b/addons/report/static/src/js/report.editor.js new file mode 100644 index 00000000000..51f774d1d12 --- /dev/null +++ b/addons/report/static/src/js/report.editor.js @@ -0,0 +1,26 @@ +odoo.define('report.editor', function (require) { +"use strict"; + +var base = require('web_editor.base'); +var options = require('web_editor.snippets.options'); + +base.reload = function () { + location.hash = "scrollTop=" + window.document.body.scrollTop; + window.location.reload(); +}; + +options.registry.many2one.include({ + select_record: function (li) { + var self = this; + this._super(li); + if (this.$target.data('oe-field') === "partner_id") { + var $img = $('.header .row img:first'); + var css = window.getComputedStyle($img[0]); + $img.css("max-height", css.height+'px'); + $img.attr("src", "/web_editor/image/res.partner/"+self.ID+"/image"); + setTimeout(function () { $img.removeClass('o_dirty'); },0); + } + } +}); + +}); \ No newline at end of file diff --git a/addons/report/views/layouts.xml b/addons/report/views/layouts.xml index 520bdd36e9b..695410b3907 100644 --- a/addons/report/views/layouts.xml +++ b/addons/report/views/layouts.xml @@ -1,25 +1,35 @@ -