跳至内容
菜单
此问题已终结
4 回复
26220 查看

Given this report definition, how can I change the file name used in the PDF so it uses names such as "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.

Thanks

形象
丢弃
最佳答案

Add 'print_report_name' in your custom module

<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"
        print_report_name = "(object.name+'.pdf')"
/>
形象
丢弃

then I add print_report_name = ... it fails with:

AssertionError: Element odoo has extra content: data, line 3

without this works fine

for avoiding AssertionError: Element odoo has extra content: data, line 3.

need to inehrit same report like this:

<record model="ir.actions.report.xml" id="sale.report_sale_order">

<field name="print_report_name">(object.name+'.pdf')</field>

</record>

最佳答案

Hi,

you  can do it like this, activate the developer mode, then go to Settings -> Technical ->reports ->reports, select the report of the sales, ie , report named Quotation / Order. Then open the report and add "((object.name or '').replace('/','')+'.pdf')" this to field Printed Report Name. Then go to sales and print the report

Thanks

形象
丢弃
编写者

Thanks, but I want to do it programmatically so I can easily setup the same in other databases. It is a custom module.

相关帖文 回复 查看 活动
1
11月 17
5645
1
9月 19
3543
1
6月 19
5639
1
9月 17
3464
0
7月 17
3621