diff options
| author | Simon Lejeune <sle@openerp.com> | 2014-03-21 11:58:06 +0100 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2014-03-21 11:58:06 +0100 |
| commit | 57e6e8fd282a385cba17ca9dcd8b77cd2bb6446b (patch) | |
| tree | 8d11f81f177cda9ea5d0d8a2e06d0ae19826d503 /addons/report | |
| parent | 246ec6854bafebdd5b81afd0ca131dae6e949801 (diff) | |
[FIX] Multiples fixes: correct context passing, changed osv.Model to osv.AbstractModel to avoid creating tables in database when the model use for the reports contains only method
bzr revid: sle@openerp.com-20140321105806-0bwo992995la91fe
Diffstat (limited to 'addons/report')
| -rw-r--r-- | addons/report/controllers/main.py | 21 | ||||
| -rw-r--r-- | addons/report/models/report.py | 19 | ||||
| -rw-r--r-- | addons/report/static/src/js/qwebactionmanager.js | 4 |
3 files changed, 12 insertions, 32 deletions
diff --git a/addons/report/controllers/main.py b/addons/report/controllers/main.py index 672cae81f77..c843d92044e 100644 --- a/addons/report/controllers/main.py +++ b/addons/report/controllers/main.py @@ -32,13 +32,12 @@ class ReportController(Controller): #------------------------------------------------------ # Generic reports controller #------------------------------------------------------ - - @route(['/report/<reportname>/<docids>'], type='http', auth='user', website=True, multilang=True) + @route('/report/<reportname>/<docids>', type='http', auth='user', website=True, multilang=True) def report_html(self, reportname, docids): cr, uid, context = request.cr, request.uid, request.context return request.registry['report'].get_html(cr, uid, docids, reportname, context=context) - @route(['/report/pdf/report/<reportname>/<docids>'], type='http', auth="user", website=True) + @route('/report/pdf/report/<reportname>/<docids>', type='http', auth="user", website=True) def report_pdf(self, reportname, docids): cr, uid, context = request.cr, request.uid, request.context pdf = request.registry['report'].get_pdf(cr, uid, docids, reportname, context=context) @@ -48,15 +47,14 @@ class ReportController(Controller): #------------------------------------------------------ # Particular reports controller #------------------------------------------------------ - - @route(['/report/<reportname>'], type='http', auth='user', website=True, multilang=True) + @route('/report/<reportname>', type='http', auth='user', website=True, multilang=True) def report_html_particular(self, reportname, **data): cr, uid, context = request.cr, request.uid, request.context report_obj = request.registry['report'] data = report_obj.eval_params(data) # Sanitizing return report_obj.get_html(cr, uid, [], reportname, data=data, context=context) - @route(['/report/pdf/report/<reportname>'], type='http', auth='user', website=True, multilang=True) + @route('/report/pdf/report/<reportname>', type='http', auth='user', website=True, multilang=True) def report_pdf_particular(self, reportname, **data): cr, uid, context = request.cr, request.uid, request.context report_obj = request.registry['report'] @@ -66,15 +64,15 @@ class ReportController(Controller): return request.make_response(pdf, headers=pdfhttpheaders) #------------------------------------------------------ - # Misc. utils + # Misc. route utils #------------------------------------------------------ - @route(['/report/barcode', '/report/barcode/<type>/<path:value>'], type='http', auth="user") def report_barcode(self, type, value, width=300, height=50): """Contoller able to render barcode images thanks to reportlab. Samples: <img t-att-src="'/report/barcode/QR/%s' % o.name"/> - <img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('QR', o.name, 200, 200)"/> + <img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % + ('QR', o.name, 200, 200)"/> :param type: Accepted types: 'Codabar', 'Code11', 'Code128', 'EAN13', 'EAN8', 'Extended39', 'Extended93', 'FIM', 'I2of5', 'MSI', 'POSTNET', 'QR', 'Standard39', 'Standard93', @@ -112,9 +110,8 @@ class ReportController(Controller): else: # Particular report: querystring = url.split('?')[1] - querystring = urlparse.parse_qsl(querystring) - dict_querystring = dict(querystring) - response = self.report_pdf_particular(reportname, **dict_querystring) + querystring = dict(urlparse.parse_qsl(querystring)) + response = self.report_pdf_particular(reportname, **querystring) response.headers.add('Content-Disposition', 'attachment; filename=%s.pdf;' % reportname) response.set_cookie('fileToken', token) diff --git a/addons/report/models/report.py b/addons/report/models/report.py index c685484c4af..79bf41158c0 100644 --- a/addons/report/models/report.py +++ b/addons/report/models/report.py @@ -187,29 +187,12 @@ class Report(osv.Model): qcontext['o'] = self.pool[model].browse(cr, uid, doc_id, context=ctx) return view_obj.render(cr, uid, template, qcontext, context=ctx) - current_user = self.pool['res.users'].browse(cr, uid, uid, context=context) - - # Website independance code - website = False - res_company = current_user.company_id - - try: - from openerp.addons.web.http import request - if request.website: - website = request.website - res_company = request.website.company_id - except: - pass - values.update({ 'time': time, - 'user': current_user, - 'user_id': current_user.id, 'formatLang': lambda *args, **kwargs: self.formatLang(*args, cr=cr, uid=uid, **kwargs), 'get_digits': self.get_digits, 'render_doc': render_doc, - 'website': website, - 'res_company': res_company, + 'editable': True, # Will active inherit_branding }) return view_obj.render(cr, uid, template, values, context=context) diff --git a/addons/report/static/src/js/qwebactionmanager.js b/addons/report/static/src/js/qwebactionmanager.js index cb04b8dc641..57163d58b20 100644 --- a/addons/report/static/src/js/qwebactionmanager.js +++ b/addons/report/static/src/js/qwebactionmanager.js @@ -49,7 +49,7 @@ openerp.report = function(instance) { } if (action.report_type == 'qweb-html' || action.report_type == 'controller') { // Open the html report in a popup - window.open(report_url, '_blank', 'height=768,width=1024'); + window.open(report_url, '_blank', 'height=900,width=1280'); instance.web.unblockUI(); return; } else { @@ -63,7 +63,7 @@ openerp.report = function(instance) { // Fallback of qweb-pdf if wkhtmltopdf is not installed if (!presence && action.report_type == 'qweb-pdf') { self.do_notify(_t('Report'), _t('Unable to find Wkhtmltopdf on this \ -system. The report will be shown in html.<br><br><a href="http://wkhtmltopdf.org/" _target="blank">\ +system. The report will be shown in html.<br><br><a href="http://wkhtmltopdf.org/" target="_blank">\ wkhtmltopdf.org</a>'), true); window.open(report_url.substring(12), '_blank', 'height=768,width=1024'); instance.web.unblockUI(); |
