Skip to Content
Menu
This question has been flagged
5 Replies
5481 Views

Hi, 

We have a website which contains a form. In this form, we get the name. surname and email from a user. What we want to do is register this user into the Odoo 8 platform. In which tables of odoo should we make Inserts?

res_partner?
res_users?
res_company_users_rel?
res_groups_users_rel?

Are we missing any table?


After that we have a custom module. We need some information about the user. How could we retrieve data from this tables? I am trying in the Model but I am missing something. 

Avatar
Discard
Best Answer

Hi John,

If user could be login to your website better to create details for res.users by default res.users would be associated to res.partner, company

Avatar
Discard
Author

No, after they are registered in the website, they after login via odoo

Indeed then it's good to create res_users

Author

So I am not missing any table and relation to insert. Thank you!! What about to retrieve data for the table res_user in the Model? I don't know how how to that.

yes just need to create res_users, rest all would be sync by default

Author

You mean the creation in another tables (res_company_users_rel,

res_groups_users_rel) is done automatically?

Indeed some default groups would part of registered users

Best Answer

Hi, 
Logically, not every client who registers his info in your Web form will have access to the Odoo application. Right ?

If it's the case, that means, in odoo platform, they are *partners*, not users. So, they should be added in res.partner table not res.users.

If it is not the case ( which i find not logical and secure, because you don't know them) : Every One who adds his infos in the web form template will get access to Odoo application, you would think of adding them to res_users table. 

Then, to retrieve them from your Model, what's your exact need ? what will you do with the data ?

you'll probably need to declare a M2o field  depending in what case i mentioned above. So 
1st case : partner_id = fields.Many2one('res.partner', ...)

2nd case : user_id = fields.Many2one('res.users', ....)

Avatar
Discard
Author

Yes, the idea is to allow the login for users which are registered throw the web form. So It is only necessary insert them into the res_users table, right? What about the other relation tables?

Creating a user will automatically create a partner associated to the user. they are linked with 'inherits'. the company will be added automatically by synchronsation.

res_company_users_rel is a relational table that contains both company_id and user_id.

by default, the company given is the connected user. In your case, it would be your Superadmin's company or the company you set default to your website.

check def _get_company(self).

res_groups_users_rel : lists the groups whose users are part of.