Skip to Content
Menu
This question has been flagged

I have a report which is showing me a comparison of rfq's on a click of button in web-view . So i already have a controller for the report now i want to download it so should i have a new controller with different url? I am facing a problem with the following code


@http.route('your custom route', methods=['POST', 'GET'], csrf=False, type='http', auth="user", website=True)
def print_id(self, **kw):
record_id = kw['rec_id']
if record_id:
pdf = request.env['report'].sudo().get_pdf([record_id], 'module_name.report_name', data=None)
pdfhttpheaders = [('Content-Type', 'application/pdf'), ('Content-Length', len(pdf))]
return request.make_response(pdf, headers=pdfhttpheaders)
else:
return request.redirect('/')
is the rec_id and **kwargs. I dont know what to do with it kindly help or guide me thorugh it
Avatar
Discard
Related Posts Replies Views Activity
1
Aug 22
5449
2
Apr 22
6851
1
Dec 19
5107
1
Feb 24
572
0
Jan 21
2170