首页 文章

如何自定义发票打印odoo 10

提问于
浏览
1

我想将我的发票pdf打印纸定制为与odoo提供的不同的东西,例如像这样
enter image description here

1 回答

  • 1
    • 如果要修改现有报告而不是继承odoo报告 . 并使用 xpath 标签进行更改 . 否则,您还可以使用xml标记创建自己的报告 . 示例可能对您有用:

    打印菜单中的报告菜单按钮:

    <report
       id="saleorder_quotation_report"
       model="account.invoice"
       string="Print Invoice"
       report_type="qweb-pdf"
       name="module_name.your_report_id"
       file="module_name.your_report_id"
       attachment_use="False"
       />
    

    示例代码:

    <?xml version="1.0" encoding="utf-8"?>
    <odoo>
        <data>
            <template id="put_your_xml_id">
                <t t-call="module_name.external_layout">
                    <t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />
                    <div class="page">
                    <div class="col-xs-6" style = "margin-top:15px;">
                        <strong>Invoicing address:</strong>
                        <div t-field="o.partner_id"
                            <!-- Here you make your own code using div and other tags -->
                        </div>
                    </div>
                </t>
            </template>
            <template id="your_report_id">
                <t t-call="report.html_container">
                    <t t-foreach="docs" t-as="o">
                        <t t-call="module_name.put_your_xml_id" t-lang="o.partner_id.lang"/>
                    </t>
                </t>
           </template>
      </data>
    

相关问题