Is it possible to display a search sql statement output in QWEB report? If yes, can you direct me to an example?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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):
self._cr.execute(qry)
_res = self._cr.dictfetchall()
return _res
<t t-foreach="docs" t-as="o">
<p>
<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>
</t>
</p>
</t>
Thank you Sajin
I am struggling on this for days. Can someone help?