Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3685 มุมมอง

Hi Community,

I have created a report named report_saleorder_2 in the print menu and I have inherited the original report_saleorder_document.Since I have two reports using the same template, I need to check a condition in order to decide whether it should render the customised part or not.So I need to pass a value from my report menu to the template for identifying this.

Thanks and regards

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Try the following code


<odoo>
<data>
<template id="report_saleorder2">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="sale.report_saleorder_document" t-lang="doc.partner_id.lang">
<t t-set="bg" t-value="True"/>
</t>
</t>
</t>
</template>
<template id="quotation_with_background_data_document" inherit_id="sale.report_saleorder_document">
<xpath expr="//div[hasclass('page')]/div" position="before">
<t t-if="condition">
</t>
</xpath>
</template>
</data>
</odoo>

If you define a variable inside a t-call, It will be available inside the template being called, so you pass data from the template call other than from report, this is possible because sale order calls one template from the main template, if it has only one template in level, we may need to find some other way.

Regards

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ส.ค. 23
2011
0
ก.พ. 21
2953
0
พ.ย. 20
1967
0
ม.ค. 20
3925
0
ต.ค. 19
2525