コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
12528 ビュー


アバター
破棄
著作者 最善の回答

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" />





アバター
破棄
関連投稿 返信 ビュー 活動
1
3月 16
2002
2
8月 25
7434
5
12月 23
29416
1
7月 25
2015
2
11月 24
1078