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

How to upload image in custom window in form view while creating new record and viewing the image after the saving record ?

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

In Python create Image field:-

_name = "table.name"

_columns = {

    'image': fields.binary("Image",help="This field holds the image"),

}

In XML Form view define:-

<field name="image" widget="image" />

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

Hi, 

Please i want to know How i can save the image in the database?

Thanks!

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

you can use option atribute for custom preview of the image.


<field name="image" widget='image' options="{'preview_image': 'image_small', 'size': [30, 30]}"/>

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