Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
12006 Vizualizări

How to change the pdf file name generated by qweb report?

Imagine profil
Abandonează
Cel mai bun răspuns

Go to page "Settings/Technical/Actions/Reports"

here you can open corresponding record you want to change file name for and edit a "Save as Attachment Prefix" field (when you hover this fields name with mouse pointer, it'll display a tooltip help message). by changing this field, you'll change filename of the attachment saved. you can use python expressions here, as for example in Invoices pdf.

hope it'll help.

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

have my own custom module and I inherit qweb report for invoicing. I use in my inherit this code in the begging:

<template id="report_invoice_document_inherit_generix" inherit_id="account.report_invoice_document">


How you can see I inherit report_invoice_document. Everything works fine but I would like to change the PDF File name. I know how do this from Setting -> Technical -> Reports and change Report Printed Name, but I do not have idea how I can define new name in my custom module.When I click on invoice in Print Menu the file name is "<number-of-invoice>.pdf", but I want to change to "Invoice-<number-of-invoice>.pdf". For example from 333.pdf to be Invoice-333.pdf.

Thank you a lot!

Imagine profil
Abandonează
Cel mai bun răspuns

Hi, hope you help.

  @api.multi

def print_qr_report_medio_oficio(self):

report_obj = self.env['report'] # Instanciando el modelo

report = report_obj._get_report_from_name('ew_qr_sale.ew_reporte_factura_qr_hoja_medio_oficio') # Obteniendo el modelo

nombre_factura = 'name_report - nr'

report.name = nombre_factura # Cambiando el nombre a la factura

return {

'type': 'ir.actions.report.xml',

'report_name': 'ew_qr_sale.ew_reporte_factura_qr_hoja_medio_oficio',

'report_type': u'qweb-pdf',

}

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
sept. 24
1862
5
aug. 19
46482
4
iun. 18
20031
0
iun. 18
3254
2
mai 16
16883