This question has been flagged
2 Replies
14029 Views

Hello All,

I put one to many field in product & pdf field as binary.

I got binary data on webpage. I want to convert into pdf file all data.

I also used jquery for that.

 

 

 

Avatar
Discard
Author Best Answer

Hello All,

I got solution.

pdf file dispaly on website page and also download it.

Here, I paste the code.

I hope it is useful to you also.

<!-- Display list of pdfs to download. -->

<div t-if="product.pdfs" class="row">
                            <b>Product Documents:</b>
                        </div>
                        <table width="100%" class="table table-responsive">
                            <t t-foreach="product.pdfs" t-as="i">
                                <tr t-if="i.pdf">
                                    <td>
                                        <t t-esc="i.name" />
                                    </td>
                                    <td>
                                        <span align="center">
                                            <a t-att-href="'data:application/pdf;base64,%s' %i.pdf"
                                                t-att-download="i.name">
                                                <img style="height:25px;width:100px;"
                                                    src="/website_pdf_download/static/src/img/PDF-Download-Button.png" />
                                            </a>
                                        </span>
                                    </td>
                                </tr>
                            </t>
                        </table>
                    </div>
                </div>

I hope this is useful to all of you.

Avatar
Discard
Best Answer

@Mohit, why don't you try to use ir.attachment instead?  Create one2many field from product to ir.attachment and then let ir.attachment handles the display using many2many_binary widget.

Avatar
Discard