This question has been flagged
1 Reply
3003 Views

I want to add a button near download in attachment to open a pdf on that button click in new tab. I am not able to extend mail.Attachment template in odoo14. Here is my code:-

<?xml version="1.0" encoding="UTF-8"?>

<templates>

    <t t-extend="mail.Attachment">

     <t>

        <t t-jquery=".o_Attachment_actionDownload" t-operation="inner">

            <span

                  class="fa fa-search ml4 o_attachment_preview"

                  t-att-data-id="attachment.id"

                  t-att-data-url="attachment.url"

                  t-on-click="_onPreviewAttachment"

                  t-attf-title="Preview #{attachment.name} in side panel"/>

      </t>

    </t>

    </t>

</templates>


What changes can make it work ?

Avatar
Discard
Best Answer

<?xml version="1.0" encoding="UTF-8"?>

<templates xml:space="preserve">

    <t t-name="mail.AttachmentSlider" 

       t-inherit="mail.Attachment"

       t-inherit-mode="extension"

       owl="1">

        <xpath expr="//div[@class='o_Attachment']" position="inside">

            <span> TEST</span>

        </xpath>

    </t>

</templates>

Avatar
Discard