Odoo Help

0

HRM: autocreate user account

By
test user
on 8/13/14, 4:29 AM 555 views

Hi, 

On OpenERP 7.0 (local install) I would like to:

- In the HRM module
- When creating an employee
- automatically create a related user for portal login

I'm sure it is possible but am looking for ideas on how :)..

 

thanks!

best, mark

0

Ludo - Neobis

--Ludo - Neobis--
2417
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 8/13/14, 5:29 AM

Override the "create" function on the hr.employee model in your own module. Then, create a portal user in the overwritten method, putting it in the values for your create method.

Something like:

class new_hr(osv.osv):

    _name = 'hr.employee'

    _inherit = 'hr.employee'

    def create(self, cr, uid, vals, context)

        my_variables = {<<list of name, groups, etc.>>}

        user_id = self.pool.get('res.users').create(cr, uid, my_variables)

        vals.update({'user_id': user_id})

        return super(new_hr, self).create(cr, uid, vals, context)

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 E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 8/13/14, 4:29 AM
Seen: 555 times
Last updated: 3/16/15, 8:10 AM