Odoo Help


one2many field in openerp

on 4/11/13, 7:42 AM 12,039 views

how to give one2many field to same model...for an example I have to create one 2 many in product.product it refers to same product.product it shows an integriyt error how to rectify this problem ???

Post the code, please

Francesco OpenCode
on 4/11/13, 7:44 AM

Sudhir Arya (SA)

--Sudhir Arya (SA)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow




Sudhir Arya (SA)
On 4/11/13, 7:52 AM

First you have to create many2one field of product.product and then you can create one2many field.

For example:

`partent_id`: fields.many2one('product.product', 'Parent Product', ondelete='cascade'),
`product_ids`: fields.one2many('product.product', 'parent_id', 'Products'),

Thanks for your reply

on 1/29/14, 2:47 AM

but it still gives the integrity error

Shivam Mahajan
on 5/2/16, 5:43 AM

Integrity Error The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it - creation/update: a mandatory field is not correctly set [object with reference: name - name]

Shivam Mahajan
on 5/2/16, 5:48 AM
On 8/27/14, 6:46 AM


I also  have created that one2many field  on same model . it works but their are no records are being displayed  in one2many field .

How to display value in one2many .

you got solution to this?

on 1/11/17, 7:15 AM

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 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

0 follower(s)


Asked: 4/11/13, 7:42 AM
Seen: 12039 times
Last updated: 8/31/15, 2:00 AM