Odoo13-CE: Module: Sales: How can I style quotation-pdf and quotation-customer preview

Viewed 56

Module: Sales: Quotations I would like to change style of text and colour of buttons in the customer preview. I would like to add padding and margin to the pdf-file.

What are the options to do these changes?

1 Answers

To customize the customer preview you need to alter the sale portal templates.

Download and Print button are defined in sale_order_portal_template template:

<div class="o_download_pdf btn-toolbar flex-sm-nowrap">
    <div class="btn-group flex-grow-1 mr-1 mb-1">
        <a class="btn btn-secondary btn-block o_download_btn" t-att-href="sale_order.get_portal_url(report_type='pdf', download=True)" title="Download">
            <i class="fa fa-download"/>
            Download
        </a>
    </div>
    <div class="btn-group flex-grow-1 mb-1">
        <a class="btn btn-secondary btn-block o_print_btn o_portal_invoice_print" t-att-href="sale_order.get_portal_url(report_type='pdf')"
           id="print_invoice_report" title="Print" target="_blank">
            <i class="fa fa-print"/>
            Print
        </a>
    </div>
</div>

To change button text style and color, you can alter the class or style attribute, In the following example we use btn-primary instead of btn-secondary class:

<template id="sale_order_portal_template" name="My Sales Orders" inherit_id="sale.sale_order_portal_template">
    <xpath expr="//a[hasclass('o_download_btn')]" position="attributes">
        <attribute name="class">btn btn-primary btn-block o_download_btn</attribute>
    </xpath>
</template>

The page content is defined inside a div with id quote_content

Related