Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
4 Risposte
26184 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona

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>

Risposta migliore

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
Abbandona
Autore

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

Post correlati Risposte Visualizzazioni Attività
1
nov 17
5633
1
set 19
3529
1
giu 19
5632
1
set 17
3451
0
lug 17
3615