Odoo Help


website_slide won't allow public download

Lindsay Slazakowski
on 6/7/16, 3:48 PM 667 views

In my "Library" on my website I can navigate to a particular slide but when I hit the download button it prompts me to login. The line in the code looks like this:

@http.route('''/slides/slide/<model("slide.slide", "[('channel_id.can_see', '=', True), ('download_security', '=', 'public')]"):slide>/download''', type='http', auth="public", website=True)
def slide_download(self, slide):
if slide.download_security == 'public' or (slide.download_security == 'user' and request.session.uid):
filecontent = base64.b64decode(slide.datas)
disposition = 'attachment; filename=%s.pdf' % werkzeug.urls.url_quote(slide.name)
return request.make_response(
[('Content-Type', 'application/pdf'),
('Content-Length', len(filecontent)),
('Content-Disposition', disposition)])
elif not request.session.uid and slide.download_security == 'user':
return werkzeug.utils.redirect('/web?redirect=/slides/slide/%s' % (slide.id))
return request.website.render("website.403")

I put in a pdb and found that whether I'm logged in or not the slide.download_security is always equal to 'user'. I've tried all combinations of removing things but usually just that results in the loss of my download button. However, if I navigate directly to the /slides/slide/#/download url it downloads. So I guess I know that is works.

How can I allow the public to download these documents without having to be logged in and still maintain my download button?

Thanks for your help!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/7/16, 3:48 PM
Seen: 667 times
Last updated: 6/8/16, 1:50 AM