首页 文章

在ODOO中将自定义名称设置为QWeb报告[重复]

提问于
浏览
2

这个问题在这里已有答案:

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

Problem:

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

“custom_reports_ept.report_export_invoice” . 我想要做的是将可下载的pdf名称设置为“导出发票”或“发票VDG290-15-16”(VDG290-15-16是发票编号)“ .

我怎么能这样做?

这是我的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>

1 回答

  • 0

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

    • 在我们的默认odoo中,我们有报告模块,

    • 到控制器 - > main.py

    • 你可以找到这个对象 def report_download(self, data, token)

    • 在此函数"docids"变量中,使用此可以获取发票记录的ID .

    • reportname 字段包含报告名称

    • 使用此条件:

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

相关问题