Odoo Help


Why do users have to have corresponding partner?

on 3/3/13, 10:51 PM 2,547 views

This seems like it probably has a basic answer, but its left me baffled. Why do users (res.users) and companies (res.company) each have a many2one 'partner_id' field? From my testing it seems this corresponding partner is what is used to check access rights rather than the user/company itself. But users and companies inherit from res.partner anyway...so why do they need this separate partner object linked to them?

Can anyone tell me what I am missing here?


Andreas Brueckl

--Andreas Brueckl--

| 7 8 7
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl
On 3/4/13, 4:51 AM

For generalization purposes res.partner is used for personal data, regardless whether this is a customer, supplier, company or a user. This makes sense, because otherwise contact data will be spread over several tables. So there is for example only one E-Mail field in the whole system.

res.company does not inherit form res.partner.

res.user inherits from res.partner, but there are 2 types of inheritance (see Developer Docu)

  • _inherit and
  • _inherits

Since res.user uses the second type, it only is related to a res.partner with partner_id. But the fields of res.partner are not directly accessible (with _inherit they would be directly accessible, but the fields would then also be in the res.user table).

_inherits in this case assures that the contact data stay in DB table res_partner instead of res_user

Very useful answer, thank you. Can I further ask, why does res_user have a company_id field if res_partner already has the same field and is meant to handle all the 'personal' data?

on 3/12/13, 5:31 PM

In response to my own second-question. I believe I now know the answer to this. User's company_id refers to the currently worked on company whereas the user's partners company_id refers to the company to which the user is actually employed (although it defaults to the admins company). Please correct me if I'm wrong :)

on 3/13/13, 12:51 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: 3/3/13, 10:51 PM
Seen: 2547 times
Last updated: 3/16/15, 8:10 AM