2

我在 ODOO 中为account.invoice模型创建了 qweb 报告。

问题:

当我们以 pdf 格式下载报告时,它命名为module_name.report_name,就像我的情况一样

“custom_reports_ept.report_export_invoice”

我想要做的是将可下载的 pdf 名称设置为"Export Invoice""Invoice VDG290-15-16" (VDG290-15-16 is invoice Number)"

我怎么能这样做?

这是我的xml代码,

<report 
    string="Export Invoice" 
    id="account.invoice_export" 
    model="account.invoice" 
    report_type="qweb-pdf"
    name="custom_reports_ept.report_export_invoice" 
    file="custom_reports_ept.report_export_invoice" 
/>

这是 qweb 模板。

    <template id="report_export_invoice">
        <t t-call="report.html_container">
            <t t-foreach="docs" t-as="o">
                <div class="page">
                    <div class="oe_structure"/>
                    <!-- report body -->
                </div>
            </t>
        </t>
     </template>
4

1 回答 1

0

我在这一点上做了一些搜索,

  1. 在我们的默认odoo中,我们有报告模块,
  2. 到控制器 --> main.py
  3. 你可以找到这个对象def report_download(self, data, token)
  4. 在这个函数“docids”变量中,使用它你可以获得发票记录的查找ID。
  5. reportname字段包含报告名称
  6. 使用这个条件:

    if reportname == 'sale.report_saleorder': #browse invoice object here 并根据您的要求生成新名称

于 2016-03-08T09:31:22.283 回答