Odoo Help


Remove all records in class b reference to class a

Trai Doan
on 11/22/14, 9:14 AM 871 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

--Mariusz Mizgier--
| 4 1 7
SOPOT, Poland
--Mariusz Mizgier--

OpenERP developer

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.

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: 11/22/14, 9:14 AM
Seen: 871 times
Last updated: 3/16/15, 8:10 AM