Skip to Content
Menu
This question has been flagged
1 Reply
3661 Views

hello! i make a wizard class in order to print a xml report.

for class variables, i don't have any problem to call them in my report 

i just do: 

{

... 

<t t-foreach="docs" t-as="o">
...
<span t-field="o.variable"/>
...
</t>
....
}
but how  can i have data coming from sql query (suppose it's dict type)? 
Avatar
Discard
Best Answer

Yes, You can write a report parser and update the localContext with your computed SQL dict from there, after your dict will be accessible from XML. If you are overriding the render_html function the you have to return a rendered file. while rendering you can update a dict and pass as a second argument. eg:


@api.multi
def render_html(self, data):
...............
return self.env['report'].render('report_id', docargs)


Here docargs is a dict and update it with your values.

Avatar
Discard