Skip to Content
Menu
This question has been flagged
2 Replies
3021 Views

I have a report which is printed from wizard and i need to send this report as an email attachment in odoo12. 

Avatar
Discard
Author Best Answer

Hi Haresh,

    Thanks for your valuable response. I tried this method but show some error.  Already i have python file for the report, then using  report_template showing  data['id'] error

Python file

@api.model
def _get_report_values(self, docids, data=None):
report_obj = self.env['ir.actions.report']
reports = report_obj._get_report_from_name('module_name.report_name')
docs = self.env['payment.receipt.wiz'].browse(data['id'])
return {
'doc_ids': docids,
'doc_model': reports.model,
'docs': docs,
'data': data,
'get_report_record': self.get_report_record}
In Xml
<t t-set="value1" t-value="get_report_record(data)"/>

Wizard

return self.env.ref('module_name.report_id').report_action(self,data=self.read([])[0])


If any solution please help.

Thanks & Regards
Anju M.P






Avatar
Discard
Best Answer

Hi Anju,

There is a option in email to attach report as attachment.

You can set report as attachment in email template. There is a field named as "report_template" in email template you can attach any report so whenever you send email then it will automatically attach report for specific model record

I hope it will very helpful for you

Thanks and regards

Haresh Kansara



Avatar
Discard