Odoo Help

0

0
1 Answer
0
Robin Hède
29/04/19 10:20

I finally found a solution to my problem.

Here is the code:

from odoo import modules, tools
login = "test.test"
class Users(object):
    def __init__(self, login, image):
        self.login = login
        self.image = image
image_path = modules.module.get_resource_path(
    'name_of_the_module',
    'static/img',
    login+'.jpg'
)
if image_path:
    image = tools.image_resize_image_big(
        open(
            image_path,
            'rb'
                ).read().encode('base64')
    )
else:
    image = ''
values = Users(login, image)
self.env['res.users'].sudo().create(values)

Best regards,
Robin Hède.
Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now