From 0ea94b4b5a823fbc522832f4624e31d9ff3c3d26 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 11 Aug 2015 12:29:04 +0200 Subject: [PATCH] [FIX] report: manage landscape view port for wkhtml Bug introduced by commit 2254a97 Fix #7960 --- addons/report/models/report.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/report/models/report.py b/addons/report/models/report.py index 261050d98a8..3beb24a6347 100644 --- a/addons/report/models/report.py +++ b/addons/report/models/report.py @@ -376,7 +376,7 @@ class Report(osv.Model): """ command_args = [] if wkhtmltopdf_state == "ok": - command_args.extend(['--viewport-size', '1024x768']) + command_args.extend(['--viewport-size', landscape and '1024x1280' or '1280x1024']) # Passing the cookie to wkhtmltopdf in order to resolve internal links. try: @@ -399,7 +399,7 @@ class Report(osv.Model): del command_args[index] del command_args[index] command_args.extend(['--orientation', 'landscape']) - elif landscape and not '--orientation' in command_args: + elif landscape and '--orientation' not in command_args: command_args.extend(['--orientation', 'landscape']) # Execute WKhtmltopdf @@ -449,7 +449,7 @@ class Report(osv.Model): if process.returncode not in [0, 1]: raise UserError(_('Wkhtmltopdf failed (error code: %s). ' - 'Message: %s') % (str(process.returncode), err)) + 'Message: %s') % (str(process.returncode), err)) # Save the pdf in attachment if marked if reporthtml[0] is not False and save_in_attachment.get(reporthtml[0]): @@ -464,8 +464,7 @@ class Report(osv.Model): try: self.pool['ir.attachment'].create(cr, uid, attachment) except AccessError: - _logger.info("Cannot save PDF report %r as attachment", - attachment['name']) + _logger.info("Cannot save PDF report %r as attachment", attachment['name']) else: _logger.info('The PDF document %s is now saved in the database', attachment['name'])