Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6226 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Compare using the key, try this.

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


Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks, I did that and it worked

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 24
1873
5
thg 8 19
46487
4
thg 6 18
20035
0
thg 6 18
3256
2
thg 12 17
16841