I need a big help.
I need to change the report filename when the pdf is downloaded.
This is the button:
<button
string="Generate Report"
name="generate_report"
type="object"
class="btn-primary"
/>
This is the "generate_report" python function:
def generate_report(self):
data = {
'blabla': self.employee_id.name,
'bla': self.employee_id.place_of_birth
}
return self.env.ref('module.action_generate_report').report_action(self, data=data)
And this is the action
<record id="action_generate_report" model="ir.actions.report">
<field name="name">Generate Report</field>
<field name="model">custom.module</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">module.generate_report_template</field>
<field name="report_file">module.generate_report_template</field>
<field name="print_report_name">"Report - %s" % object.name</field>
<field name="paperformat_id" ref="paperformat_margin" />
</record>
If i use the "Print" button it works correctly, but if i use the custom button the solution above not work, everytime the file is downloaded, it has the name "Generate Report.pdf"
How to solve this problem?
Thank you