Created
May 24, 2019 04:56
-
-
Save bitodoo/75c279581c0d0aae4ae09845af249762 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
from odoo import tools | |
@api.model | |
def _default_image(self): | |
image_path = get_module_resource('hr', 'static/src/img', 'default_image.png') | |
return tools.image_resize_image_big(base64.b64encode(open(image_path, 'rb').read())) | |
image = fields.Binary( | |
"Photo", default=_default_image, attachment=True, | |
help="This field holds the image used as photo for the employee, limited to 1024x1024px.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment