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.


Remove all records in class b reference to class a

Trai Doan
on 11/22/14, 9:14 AM 581 views

I have 2 classes

    class material(osv.osv):
            _name = "tt_material" 
            _columns = {
                'name': fields.char('Code',size=100,required=True), 
                'ten': fields.char('Name',size=100),
    class bill(osv.osv):
            _name = "tt_bill" 
            _columns = {
                'name': fields.char('Code',size=20,required=True),
                'danhsach': fields.one2many('tt_material','ds','Material List'),

When i remove a record in class bill , i want to remove all record depend on its in class material .How can i do that ? Please help me .Thanks 

Kelly Stuart
On 11/22/14, 9:38 PM

Hello Trai,

You can put ondelete="cascade" in the definition of 'ds' field of calss 'material'.


I hope this helps!

Mariusz Mizgier
On 11/22/14, 11:09 AM

Take a look at https://www.odoo.com/forum/help-1/question/delete-one2may-records-when-parent-record-is-deleted-30898 - that should solve your problems.

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)


Asked: 11/22/14, 9:14 AM
Seen: 581 times
Last updated: 3/16/15, 8:10 AM