Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
12432 Zobrazení


Avatar
Zrušit
Autor Nejlepší odpověď

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





Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
bře 16
2002
1
říj 18
7257
5
pro 23
29241
1
čvc 25
1828
2
lis 24
1002