Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
3 Відповіді
11544 Переглядів

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

Аватар
Відмінити
Найкраща відповідь

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.

Аватар
Відмінити
Найкраща відповідь

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!

Аватар
Відмінити
Найкраща відповідь

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',

}

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
вер. 24
1302
5
серп. 19
46014
4
черв. 18
19334
0
черв. 18
2905
2
трав. 16
16096