[IMP] base, web: define landscape in report template
Since report refactoring the function to override is get_report_values that only returns a dict of value that are used in rendering. In order to render a pdf with a landscape orientation, a context key could be added however since it's not possible to return a report object in get_report_values, it's difficult to add a contexti without using some tricks. This commit add a report option to use in the template that will be used in order to modify the pdf orientation. The process used was already existing for other options like dpi,...
This commit is contained in:
committed by
Simon Lejeune
parent
3242fced63
commit
f384db9b67
@@ -50,6 +50,7 @@
|
||||
t-att-data-report-margin-top="data_report_margin_top"
|
||||
t-att-data-report-header-spacing="data_report_header_spacing"
|
||||
t-att-data-report-dpi="data_report_dpi"
|
||||
t-att-data-report-landscape="data_report_landscape"
|
||||
t-att-web-base-url="web_base_url">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
@@ -206,6 +206,9 @@ class IrActionsReport(models.Model):
|
||||
:param set_viewport_size: Enable a viewport sized '1024x1280' or '1280x1024' depending of landscape arg.
|
||||
:return: A list of string representing the wkhtmltopdf process command args.
|
||||
'''
|
||||
if landscape is None and specific_paperformat_args and specific_paperformat_args.get('data-report-landscape'):
|
||||
landscape = specific_paperformat_args.get('data-report-landscape')
|
||||
|
||||
command_args = []
|
||||
if set_viewport_size:
|
||||
command_args.extend(['--viewport-size', landscape and '1024x1280' or '1280x1024'])
|
||||
|
||||
Reference in New Issue
Block a user