Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
12004 Tampilan

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

Avatar
Buang
Jawaban Terbai

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.

Avatar
Buang
Jawaban Terbai

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!

Avatar
Buang
Jawaban Terbai

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

}

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Sep 24
1862
5
Agu 19
46482
4
Jun 18
20031
0
Jun 18
3254
2
Mei 16
16882