Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
12523 มุมมอง


อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I got this Code from Base code itself, anyway this will be helpful for those who searching for default image in odoo 9.

In Header, 

from openerp.tools import openerp,image_colorize, image_resize_image_big


In Py,

photo = fields.Binary(string="Image to upload", default=lambda self:self._get_default_image())


@api.model

def _get_default_image(self, colorize=False):

image = image_colorize(open(openerp.modules.get_module_resource('base','static/src/img', 'avatar.png')).read())

return image_resize_image_big(image.encode('base64'))


In Xml, should specify widget="image" for showing image in Form.

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





อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 16
2002
2
ส.ค. 25
7431
changing the default company logo image แก้ไขแล้ว
5
ธ.ค. 23
29412
Best product image size and resolution? แก้ไขแล้ว
1
ก.ค. 25
2009
2
พ.ย. 24
1078