Reputation: 5495
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
Upvotes: 2
Views: 3076
Reputation: 2533
The field you are looking for is print_report_name
. Help text for the field says:
This is the filename of the report going to download. Keep empty to not change the report filename. You can use a python expression with the object and time variables.
The field is defined on ir.actions.report.xml
. See the definition here.
Simplest way to use it is via web UI: Settings -> Reports -> Reports
Choose the desired report and fill in the Printed Report Name field.
For example I have something like this there:
'ABC_' + ('Sale_Order' if object.state == 'sale' else 'Quotation') + '_' + object.name + '.pdf'
which will result to: ABC_Sale_Order_SO0001.pdf
The expression is evaluated here, if you'd like to see where the magic happens ;)
Upvotes: 6
Reputation: 4174
Use attribute string
.
<report id="action_report_followup"
model="account_followup.followup"
string="Follow-up Report"
report_type="qweb-pdf"
name="payment_followup.report_followup"
file="payment_followup.report_followup"
menu="True"/>
Hope it will help you.
Upvotes: -1
Reputation: 664
For giving your custom pdf file name use field "report_name".
For more information and any help related qweb report you can refer following link:
https://www.odoo.com/documentation/10.0/reference/reports.html
Upvotes: 1