在报告定义 Odoo 10 中更改 pdf 文件名

Change pdf file name in report definition Odoo 10

鉴于此报告定义,我如何更改 PDF 中使用的文件名,使其使用 "SO-001.pdf".

等名称
<report
        id = "report_custom_sale_order"
        string = "Quotation / Order"
        model = "sale.order"
        report_type = "qweb-pdf"
        file = "custom_saleorder.report_saleorder"
        name = "custom_saleorder.report_saleorder"
        paperformat = "custom_saleorder.paperformat_a4"
/>

Odoo 10.

谢谢

要给您的自定义 pdf 文件名,请使用字段“report_name”。

有关更多信息和任何与 qweb 报告相关的帮助,您可以参考以下 link:

https://www.odoo.com/documentation/10.0/reference/reports.html

使用属性string.

 <report id="action_report_followup"
   model="account_followup.followup"
    string="Follow-up Report"
    report_type="qweb-pdf"
    name="payment_followup.report_followup"
    file="payment_followup.report_followup"
     menu="True"/>

希望对您有所帮助。

您要找的字段是print_report_name。该字段的帮助文本显示:

This is the filename of the report going to download. Keep empty to not change the report filename. You can use a python expression with the object and time variables.

该字段在 ir.actions.report.xml 上定义。 See the definition here.

最简单的使用方法是通过网络 UI:设置 -> 报告 -> 报告
选择所需的报告并填写打印的报告名称字段。

例如我有这样的东西:
'ABC_' + ('Sale_Order' if object.state == 'sale' else 'Quotation') + '_' + object.name + '.pdf' 这将导致:ABC_Sale_Order_SO0001.pdf

表达式 is evaluated here,如果你想看看魔术发生的地方 ;)