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

how to make a field that I can save a image?

I have try it like this:

def _get_image(self, cr, uid, ids, name, args, context=None):

result = dict.fromkeys(ids, False)

for obj in self.browse(cr, uid, ids, context=context):

result[obj.id] = tools.image_get_resized_images(obj.image)

return result

def _set_image(self, cr, uid, id, name, value, args, context=None):

return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)

'image': fields.binary("Image",

help="This field holds the image used as image for our customers, limited to 1024x1024px."),


but this is not working. any help? thank you

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

I also want to know how to save a figure and even more when we plot a figure by matplotlib.pyplot, whether this figure can be saved in "fields.Binary()"?

What version are you using?

Tác giả Câu trả lời hay nhất

I found a way on odoo 8. 

It's very simple.

You only need to define a binary field and there you can save your image.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 16
3021
1
thg 7 25
2026
0
thg 4 24
1841
4
thg 11 23
5889
0
thg 10 23
1692