Odoo Help


How to Create openerp user through Python code ?

on 10/17/13, 8:20 AM 5,730 views

How to Create openerp user through Python code ?

what are the required infor' ? [i tried below but its gives a error ]

res_users_obj = self.pool.get('res.users')
user_id = super(res_users, res_users_obj).create(cr, uid, {'login':'given_name' ,'password':'given_name'}, context=context)

my requirement is that , I need to create user when i'm create a employee

please help me to sort out this issue


Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 10/17/13, 10:58 AM


here you need to override the create method of hr.employee.

def create(self, cr, uid, vals, context=None):
    user_obj = self.pool.get('res.users')
    vals_user = {
        'name': vals.get('name'),
        'login': default_login,
        #other required field 
    user_obj.create(cr, uid, vals_user, context)
    result = super(hr_employee, self).create(cr, uid, vals, context=context)
    return result

Hope this will help you.

Thank you,

Serpent Consulting Services

can we add dictionary list for vals in below code line 'create(self, cr, user, vals, context=None):' for insert multiple records.?

on 11/4/13, 5:44 AM

Why you need to add list of dictionary. As per your requirement it will be create a user at time of record creation.

Serpent Consulting Services Pvt. Ltd.
on 11/8/13, 7:13 AM

thanks dear friend now issue sorted :-)

on 11/8/13, 7:31 AM

@priyankahdp, What is that default_login?

on 2/5/16, 4:50 AM

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 10/17/13, 8:20 AM
Seen: 5730 times
Last updated: 1/6/17, 2:46 PM