Deleting records

To delete a data record, we use the <delete> element, providing it with either an ID or a search domain to find the target records. For example, using a search domain to find the record to delete looks as follows:

<delete 
  model="ir.rule" 
  search="[('id','=',ref('todo_app.todo_task_user_rule'))]" 
/>

If we know the specific ID to delete, we can use it with the id attribute instead. It was the case for the previous example, so it could also be written like this, for the same effect:

<delete model="ir.rule" id="todo_app.todo_task_user_rule" /> 

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.