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

                        <notebook>

                            <page name="chart" string="Chart">

                                <field name="graph_url" readonly="1" />

                                <div>

                                    <!-- <img t-att-src="record.graph_url" alt="Graph Image"/> -->

                                </div>

                            </page>

                        </notebook>


So, the above code the graph_url is a char field containing the url to an image,


I want ot display it in the form


But it gives an owl error ... how do i just show it ??


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

Assuming you have a custom field x_image_url that is a character field for the URL, you can create a custom HTML field called x_image which has the following compute code:

for record in self:
    if record.x_image_url:
        record['x_image'] = f'<img src="{record.x_image_url}" style="max-width: 200px;"/>'
    else:
        record['x_image'] = ''


Result:

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 25
1896
1
thg 4 25
2354
1
thg 2 25
1652
0
thg 10 24
1432
7
thg 9 24
25806