Try this .
write a function in your report model to run sql statement and return the result , so u can pass sql qry from Qweb Report,
def run_sql(self, qry):
_res = self._cr.dictfetchall()
<t t-foreach="docs" t-as="o">
<t t-set="emp_count" t-value="o.run_sql('select COUNT(*) from hr_employee')"/>
<t t-set="latest_partner" t-value="o.run_sql('select id, name from res_partner order by id DESC limit 10')"/>
<p > Employee Count: <span t-esc="emp_count" /> </p>
<t t-foreach="latest_partner" t-as="part">
<p> Customer - <span t-esc="part_index"/>: <span t-esc="part"/> </p>
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 12/12/14, 12:44 PM|
|Seen: 1948 times|
|Last updated: 3/16/15, 8:10 AM|