コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4 返信
4537 ビュー

I'm trying to generate a report like described in https://www.odoo.com/documentation/11.0/howtos/backend.html#reporting

    <report
id="report_session"
model="custom_module.voiture"
string="Session Report"
name="custom_module.report_session_view"
file="custom_module.report_session"
report_type="qweb-html" />

    <template id="report_session_view">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<t t-foreach="docs" t-as="doc">
<div class="page">
<h2 t-field="doc.name"/> <p>Test</p>
</div>
</t>
</t>
</t>
</template>


The problem I have is that the variable docs, which is supposed to be a set of the records of custom_record.voiture is always empty even though records exist in the system

アバター
破棄

Odoo Report References:

How to create Qweb reports

1- https://goo.gl/tg2Zyp

How to create custom reports in Odoo (Qweb)

2- https://goo.gl/KZEo8X

著作者 最善の回答

From the documentation I thought that I had to call the <report> action from a menuitem, and that would select the whole set of the records of the model voiture. But this is not the case, declaring the <report> action on a model put it under the "printing" menu that appear when we select several record in a list view of the correct model. Then the variable including "docs" will be the set of records previously selected.

アバター
破棄
最善の回答

Dear Francois,

Try to Reverse report reference and template like this

    <template id="report_session_view">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<t t-foreach="docs" t-as="doc">
<div class="page">
<h2 t-field="doc.name"/> <p>Test</p>
</div>
</t>
</t>
</t>
</template>
    <report
id="report_session"
model="custom_module.voiture"
string="Session Report"
name="custom_module.report_session_view"
file="custom_module.report_session"
report_type="qweb-html" />
if it don't work try separate the template in another xml file and change the file path.


I hope I helped you ..

アバター
破棄
著作者

Thank you for your advice. But unfortunately it didn't seem to solve the problem.

関連投稿 返信 ビュー 活動
2
2月 24
26059
2
12月 17
3310
0
3月 18
4366
5
12月 19
10712
5
5月 19
3222