【发布时间】:2022-02-04 21:17:56
【问题描述】:
模块:销售:报价 我想在客户预览中更改文本样式和按钮颜色。 我想为 pdf 文件添加填充和边距。
有哪些选项可以进行这些更改?
【问题讨论】:
模块:销售:报价 我想在客户预览中更改文本样式和按钮颜色。 我想为 pdf 文件添加填充和边距。
有哪些选项可以进行这些更改?
【问题讨论】:
要自定义客户预览,您需要更改 sale portal templates。
Download 和Print 按钮在sale_order_portal_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>
要更改按钮文本样式和颜色,您可以更改class 或style 属性,在以下示例中,我们使用btn-primary 代替btn-secondary 类:
<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>
页面内容定义在一个id为quote_content的div中
【讨论】: