[IMP] base, survey: add option to enable smart-shnking

This commit adds a boolean field `disable_shrinking` in model
`report.paperformat`, which, if set to True, will add one
argument `--disable-smart-shrinking` in commands that prevents
the pdf shrinking. See issue[1] for more information.

This options is utilized for printing survey certificaiton.

issue[1] - https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3226

taskID-2483393
This commit is contained in:
Dharmraj Jhala
2021-03-23 10:08:58 +00:00
parent 0d01561462
commit 9e4c8d61ea
3 changed files with 4 additions and 0 deletions
+1
View File
@@ -13,6 +13,7 @@
<field name="margin_right">0</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">0</field>
<field name="disable_shrinking" eval="True"/>
</record>
<!-- QWeb Reports -->
<record id="certification_report" model="ir.actions.report">
@@ -324,6 +324,8 @@ class IrActionsReport(models.Model):
command_args.extend(['--orientation', str(paperformat_id.orientation)])
if paperformat_id.header_line:
command_args.extend(['--header-line'])
if paperformat_id.disable_shrinking:
command_args.extend(['--disable-smart-shrinking'])
if landscape:
command_args.extend(['--orientation', 'landscape'])
@@ -182,6 +182,7 @@ class report_paperformat(models.Model):
], 'Orientation', default='Landscape')
header_line = fields.Boolean('Display a header line', default=False)
header_spacing = fields.Integer('Header spacing', default=35)
disable_shrinking = fields.Boolean('Disable smart shrinking')
dpi = fields.Integer('Output DPI', required=True, default=90)
report_ids = fields.One2many('ir.actions.report', 'paperformat_id', 'Associated reports', help="Explicitly associated reports")
print_page_width = fields.Float('Print page width (mm)', compute='_compute_print_page_size')