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.
Tried a couple things that didn't work.
I have PDF files I want to link to on a Website-Builder page. #1) where do I put the documents. #2) how do I specify the link to that document (ie., /document/this-is-the-pdf.pdf)?
We also coped with the same problem. The only way found:
1) Install module Document Management System (document).
2) Create directory (knowledge menu unit) or use existing one. Attach to this category required file (button "Attachments" above the form)
3) Since it was downloaded, it would generate an url. To access it: mouse right click on downloaded file - save url
4) Add the url to the website. Pressing it will download the file (publically available).
Hey, Manuel! Regretfully, there is no enough karma to comment or answer another time. That's why this answer would be extended.
So. Programatically, it is pretty much the same. The module 'document' allows to attach files to any object, including product.product (or product.template). So you have to find it:
attachment_ids = self.env['ir.attachment'].search([('res_model','=','product.product'),('res_id','=',product.id)]).
Where product.id - is id of needed product. E.g. you can store attachment_ids in product.product class as one2many field. After that you can get an url of any attachment. For example, for binary files:
for attach in attachment_ids:
url = 'https://yourcompany.com'+'/web/binary/saveas?model=ir.attachment&field=datas&filename_field=name&id='+str(attach.id)
This url may be easily added to the website product site, using foreach in product.attachment_ids
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
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: 1/12/15, 11:45 AM|
|Seen: 5306 times|
|Last updated: 7/20/15, 8:50 AM|