콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
5610 화면

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

아바타
취소

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?

작성자 베스트 답변

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.

아바타
취소
관련 게시물 답글 화면 활동
0
3월 16
3071
1
7월 25
2259
0
4월 24
1956
4
11월 23
6054
0
10월 23
1800