Odoo Help


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.


question about one2one / many2one

Brian Martin
on 9/11/13, 3:39 PM 2,076 views

I am considering creating a one2one relationship from partner to another object so that I don't clutter the base partner table with a lot of redundant columns - to create a different type of partner with more attrinbutes.

I realize I need to use the many2one field since one2one is deprecated.

My question lies in the rendering of this data:

  • It seems that I can only represent the related object as a tree view list embedded in the parent object's form .
  • I can't find a way to show a form view directly within the parent object form.

It would be nice to show all this information directly if its just a one2one relationship.

Anyone have a similar situation? Is this where "properties" might be a good solution?


Jeudy Nicolas

--Jeudy Nicolas--
| 6 7 8
--Jeudy Nicolas--

- Linux administrator - Functional guy with OpenERP - Python, html, css, javascript developer OpenERP Ready Partner

Jeudy Nicolas
On 9/11/13, 3:55 PM


You have to inherit your parent object. For example:

  • Take project.task model and you want to have a new model project.task.request, that has all project.task fields and some other

You can define your new model like this:

class project_task_request(osv.Model):

_inherits = {
    'project.task': 'task_id',

_name = "project.task.request"
_description = 'Request (Issue)'

_columns = {
    'task_id': fields.many2one('project.task', required=True,
                               string='Related Task', ondelete='cascade',
                               help='Task-related data of the request'),
    #... many other fields ...

If you want to have a tree, form, kanban, etc view with all fields, you can create a view on this new object.

You can check inheritance info here:

Brian Martin
On 9/11/13, 4:18 PM

Thanks, I've never seen this syntax?

class project_task_request(osv.Model):

_inherits = {
    'project.task': 'task_id',

what is the difference between this and just

_inherits = 'project.task'

this one add field in project_task database table, my proposal add a new table and inherit the first one.

Tuxservices, Jeudy Nicolas
on 9/11/13, 4:51 PM

This is another question... I guess you have to create a new one or add comments to comment your original question not add a answer as another question. From the forum rules: Answers should not add or expand questions. Instead either edit the question or add a comment. https://www.odoo.com/forum/help-1/faq

Rui Andrada
on 8/19/14, 1:57 PM

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

0 follower(s)


Asked: 9/11/13, 3:39 PM
Seen: 2076 times
Last updated: 3/16/15, 8:10 AM