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

Hi

I would like to know how can I use an option of a selection field in a view to show a custom field in a report

For example I have this selection field

mySelection = fields.Selection([
('01', 'Number 1'),
('02', 'Number 2'),
('03', 'Number 3'),
('04', 'Number 4')
],required=True)

And I would like to show in a report a custom field when for example the option 02 is selected

Im trying like this 

<t t-if="doc.mySelection == 'Number 2'">
<span t-field="custom_field"/></t>

But it doesn't show my field

Thank you for the help

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

Hi,

Compare using the key, try this.

<t t-if="doc.mySelection == '02'">
<span t-field="custom_field"/></t>


Thanks

อวตาร
ละทิ้ง
ผู้เขียน

Thanks, I did that and it worked

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ย. 24
1879
How do i create report in Qweb? แก้ไขแล้ว
5
ส.ค. 19
46491
4
มิ.ย. 18
20039
0
มิ.ย. 18
3259
2
ธ.ค. 17
16845