Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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)|
|elif not request.session.uid and slide.download_security == 'user':|
|return werkzeug.utils.redirect('/web?redirect=/slides/slide/%s' % (slide.id))|
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 6/7/16, 3:48 PM|
|Seen: 508 times|
|Last updated: 6/8/16, 1:50 AM|