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

I want to show an image on a product form using an URL. How can this be done?

Thank you

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

Hello,

First you create an HTML computed field and a text field which will hold the url. Then you will compute the HTML field value as

let the field holding the url be image_url
let the computed html field be image_display



image_display = fields.HTML(copute="display_image")
@api.depends('image_url')
def display_image(self):
    for record in self:
        record.image_display = "&lt ; img src='%s' width='100' &gt ;" % record.image_url
    


Ảnh đại diện
Huỷ bỏ