From 8d43fc46f29c343bf3d1f8c6c5a09ff1a0de58e9 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Wed, 12 Oct 2016 13:37:52 +0200 Subject: [PATCH] [FIX] report: add missing context This PR allow to use the context to specify contextual informations used in the create method of ir.attachement. Closes #13790 --- addons/report/models/report.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/report/models/report.py b/addons/report/models/report.py index 0bd99c26ed8..0cc0b81ad81 100644 --- a/addons/report/models/report.py +++ b/addons/report/models/report.py @@ -265,7 +265,8 @@ class Report(osv.Model): return self._run_wkhtmltopdf( cr, uid, headerhtml, footerhtml, contenthtml, context.get('landscape'), paperformat, specific_paperformat_args, save_in_attachment, - context.get('set_viewport_size') + context.get('set_viewport_size'), + context ) @api.v8 @@ -372,7 +373,7 @@ class Report(osv.Model): def _check_wkhtmltopdf(self): return wkhtmltopdf_state - def _run_wkhtmltopdf(self, cr, uid, headers, footers, bodies, landscape, paperformat, spec_paperformat_args=None, save_in_attachment=None, set_viewport_size=False): + def _run_wkhtmltopdf(self, cr, uid, headers, footers, bodies, landscape, paperformat, spec_paperformat_args=None, save_in_attachment=None, set_viewport_size=False, context=None): """Execute wkhtmltopdf as a subprocess in order to convert html given in input into a pdf document. @@ -475,7 +476,7 @@ class Report(osv.Model): 'res_id': reporthtml[0], } try: - self.pool['ir.attachment'].create(cr, uid, attachment) + self.pool['ir.attachment'].create(cr, uid, attachment, context) except AccessError: _logger.info("Cannot save PDF report %r as attachment", attachment['name']) else: