Skip to Content
Menu
This question has been flagged
1 Reply
2197 Views

Hello,


I've added a Many2one field in product.template model

MyPDF = fields.Many2one('documents.document')

I displayed this field in product.template form and it works fine.


When a file is selected, there is a link

To open the file, i click on this link whicjh open a popup and i can download the file

But i would to open directly the file in aother tab of my web browser without open a popup and download the file. 

Is it possible to do that and if yes, how?

Thanks

Avatar
Discard
Best Answer

Hello JJB

For preview document file you need to create one related field for showing your file in product template
document = fields.Many2one('documents.document')
file = fields.binary(related=document.datas)

After set this field in product template you just need to install one of OCA module to preview your binary field.
https://odoo-community.org/shop/product/preview-attachments-531#attr=8382

Hope this will help you.
Thanks

Avatar
Discard
Author

Hello Husain

Thanks for your answer.

I was thinking that it was possible to use the viewer in document module.

In Documents module, when you select a file, you have on the right, a thumbnail of the file and when you click on it, there is a preview of the file. It will be perfect for me if i can do the same thing in other view