Skip to Content
Menu
This question has been flagged
2 Replies
562 Zobrazenia

Hello,
I need to add an attachment (product draw), saved on product master data, to the bottom of pdf report of sales order.
Is it possible and how ?
Thanks

Avatar
Zrušiť
Autor Best Answer

Thanks so much , I will try it with the help of a programmer

Avatar
Zrušiť
Best Answer

Hi,

we can inherit the template and add the condition like 

<t t-if="o.order_line">
    <div class="page">
        <h2>Sales Order</h2>
        <!-- Other content of the report -->

        <!-- Loop through order lines -->
        <t t-foreach="o.order_line" t-as="line">
            <div>
<h3 t-field="line.product_id.display_name"/>
                <!-- Other line information -->

                <!-- Display product drawing attachment -->
<t t-if="line.product_id.attachment_ids">
                    <h4>Product Drawing:</h4>
<t t-foreach="line.product_id.attachment_ids" t-as="attachment">
<a t-att-href="'/web/content/' + str(attachment.id) + '?download=true'" t-att-target="'_blank'">
<t t-esc="attachment.name"/>
                        </a>
                    </t>
                </t>
            </div>
        </t>
    </div>
</t>


Hope it helps

Avatar
Zrušiť