Hi,
I use the "auth_ldap" module that allows you to sync users between an LDAP server and Odoo.
I override the method to create the user to set automatically an image to an user by its login.
I can define an image to a user when I set directly a string encoded in base64.
But now, I would like to open an image stored in the static files of the module and convert it to base64 string.
I use the following code to search the image but it does not work.
import os
import base64
class Users(object):
def __init__(self, login, image):
self.login = login
self.image = image
img = os.path.join('name_of_the_module', 'static','src', 'img', login+'.jpg')
values = Users("test.test", base64.b64encode(img))
self.env['res.users'].sudo().create(values)
Can you help me?
Best regards,
Robin Hède.