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
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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?
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký