[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
This commit is contained in:
Laurent Mignon (ACSONE)
2016-12-14 16:43:25 +01:00
committed by Martin Trigaux
parent 3ac2904b46
commit 8d43fc46f2
+4 -3
View File
@@ -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: