Odoo Help

Welcome!

This community 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.

0

HRM: autocreate user account

By
test user
on 8/13/14, 4:29 AM 370 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--
2387
| 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)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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