How to set PDF name in qWeb report, Odoo?

后端 未结 8 1913
灰色年华
灰色年华 2021-01-12 13:41

I\'m making reports using qWeb in Odoo 8. Those generated PDF files are saved with a \"default\" name. I would like to set a specific name to every generated file (not after

8条回答
  •  醉酒成梦
    2021-01-12 14:11

    addons\report\controllers\main.py

    Line : 127

    response.headers.add('Content-Disposition', 'attachment; filename=%s.pdf;' % reportname)
    

    change it with

    invoicename="ma_facture" #create a variable you can add date for example stfftime("%d-%m-%Y")
    response.headers.add('Content-Disposition', 'attachment; filename=%s.pdf;' % invoicename)
    

提交回复
热议问题