This question has been flagged
5 Replies
35352 Views

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)?

Avatar
Discard

I'd like to do the same, maybe you can share what you did and we can help each other out?

Best Answer

Hey, Mark!

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

 

 

Avatar
Discard
Best Answer

I use a subdomain on another server that uses PHP and simply change with a link from Odoo using <a href="https://</a>

Avatar
Discard
Best Answer

Please, can you give us a link of the module "Document Management System"

 I can't find it in Odoo v9.0c...


UPDATE:

The module name is:  "Attachments List and Document Indexation"
It's installed in Odoo by other module (maybe stock or mrp?)

UPDATE2:

The module "Documents/Attachments on Website Shop" (20€) allows to add attachments and to download these to the customers:
https://www.odoo.com/apps/modules/9.0/website_product_shop_attachment/

Avatar
Discard
Best Answer

Hi IT Libertas,

Did you find a way to do this programatically? If you had an odoo instance with 500 products, one attachment per product, does it mean you would manually create the link for the 500 of them?

Thanks in advance.

 

THANKS IT Libertas!!

Avatar
Discard