Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Sometimes I find myself looping through a browse() call and needing to delete a related object. Is it better to append the id to delete to a list and, after the loop, call unlink using the list? Or is just calling unlink each time, deleting a single record at a time, good enough?
The unlink function used in openerp can be apply in the case of a list of records, Only thing is you have to pass the record ids you wish to delete as arguements in unlink method. But Be careful, once a record deleted cannot be retrieved.
self.pool.get('your.model.name').unlink(cr, uid, list_ids, context=context)
The above piece of code will help you to unlink your records. Thanks
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 2/2/14, 6:03 PM|
|Seen: 3806 times|
|Last updated: 3/16/15, 8:10 AM|