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

Hi, i am trying to print key and value of dict item in for loop. I managed to print keys but, i don't know how to print values of them. My code :

<odoo>

        <data>

        <template id="index">

                <title>artin_review</title>

                <h1>Review Module</h1>

                <h2 class="lead">Reviews of Hotel</h2>

                <t t-foreach="summary" t-as="summary_part">

                        <p><t t-esc="summary_part"/></p>

                </t>


        </template>

        </data>

</odoo>

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

hello

for print the value you have to use keyword _value at the end of your variable.

like 

 <t t-foreach="summary" t-as="summary_part">

              <p><t t-esc="summary_part"/></p> <!-- print key -->

              <p><t t-esc="summary_part_value"/></p> <!-- print value -->

</t>

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

i try this code to read dictionary but it dose not work


<select name="gender"id="gender"class="form_control">
​<option>Select Genderoption>
​<option t-att-value="gender">
​<t t-out="gender_value"/>
option>
select>
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ย. 18
106
1
พ.ค. 17
8471
1
ส.ค. 16
6108
0
ก.พ. 25
1124
2
ธ.ค. 24
1468