跳至內容
選單
此問題已被標幟
3783 瀏覽次數

hello guys

I am trying to fetch data using sql query

my code :

wizard :

class dbreport(models.TransientModel):
_name = "bdb.wizard.report"
_description = "trying to run report from db query"

gl = fields.Many2one('account.account', string='general ledge name')


def rep_print(self):
rr = """ select b.code,a.debit,a.credit from account_move_line a
inner join account_account b on b.id = a.account_id
"""
self.cr.execute(rr)
datas = self.env.cr.fetchone()[0] or 0.0
data = {
'form_data': self.read()[0],
'datas': datas,
}

return self.env.ref('nidal.db_wizard').report_action(self, data=data)

in report and template :

xml version="1.0" encoding="utf-8"?>


id="db_wizard" model="ir.actions.report">
name="name">dbwizard
name="model">bdb.wizard.report
name="report_type">qweb-pdf
name="report_name">nidal.report_db_wizard
name="report_file">nidal.report_db_wizard
name="binding_model_id" ref="model_bdb_wizard_report"/>
name="binding_type">report


id="report_db_wizard">
t-call="web.html_container">
t-call="web.external_layout">
class="page">
class="oe_structure">
class="text-center">

تقرير









id :
t-esc="form_data['gl'][0]"/>

class="table table-bordered">








t-foreach="datas" t-as="line">







code debit credit

t-esc="line['b.code']"/>

t-esc="line['b.debit']"/>

t-esc="line['b.credit']"/>















頭像
捨棄
作者
id="report_db_wizard">
t-call="web.html_container">
t-call="web.external_layout">
class="page">
class="oe_structure">
class="text-center">

تقرير









id :
t-esc="form_data['gl'][0]"/>

class="table table-bordered">








t-foreach="datas" t-as="line">







code debit credit

t-esc="line['b.code']"/>

t-esc="line['b.debit']"/>

t-esc="line['b.credit']"/>












相關帖文 回覆 瀏覽次數 活動
1
8月 22
4705
1
6月 22
3100
1
4月 25
3680
0
5月 22
3247
1
4月 25
1027