[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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user