Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
4 Vastaukset
26171 Näkymät

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

Avatar
Hylkää
Paras vastaus

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')"
/>
Avatar
Hylkää

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>

Paras vastaus

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

Avatar
Hylkää
Tekijä

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

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
marrask. 17
5620
1
syysk. 19
3509
1
kesäk. 19
5618
1
syysk. 17
3422
0
heinäk. 17
3600