Skip to Content
Menu
This question has been flagged

How do I pass data to report_action()  in Odoo 11 Windows Enterprise?  (https://github.com/odoo/odoo/blob/11.0/odoo/addons/base/ir/ir_actions_report.py#L673 does not mention the data parameter)

I am using to report_action(); I added a button that prints my pdf template if I only pass the browse record parameter  but if I try to pass some data with the data parameter  I get a corrupted pdf that can not be opened with Adobe Reader; same template works fine without data (just the browse record).

This works:

@api.multi
def print_my_pdf_report(self, options):
return self.env.ref('my_module_name.my_report_id').report_action(self)

But this does not work:

@api.multi
def print_my_pdf_report(self, options):
    # Some sample data
    datas = {     
        'lines': [],       
        'report_name': 'My Report Name'
    }
return self.env.ref('my_module_name.my_report_id').report_action(self, data=datas)

My sample template:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="my_sample_template">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<div class="page">
<h2>Report title</h2>
<p>This object's name is
<span t-field="o.name"/>
</p>
</div>
</t>
</t>
</t>
</template>
</data>
</odoo>


Avatar
Discard
Author Best Answer

Sehrish, not exaclty what I am looking for; question is how to pass data to QWEB template (Odoo 11 E)

.report_action(self, data=datas) 

Avatar
Discard

any solution ??

Related Posts Replies Views Activity
1
Jul 18
2837
1
Jul 21
2335
1
Jun 24
865
1
Feb 23
2121
0
Oct 22
1321