In Odoo as we all know, the delete button inside the Action menu helps to delete the corresponding record.When we click on the delete button, the function unlink in the respective model is executed.
2. ● In Odoo as we all know, the delete button inside the Action menu helps
to delete the corresponding record.
● When we click on the delete button, the function unlink in the
respective model is executed.
● If you want add any additional functionality, when we are deleting a
record then you will need to override the unlink function.
Let’s check this with an example.
We are going to raise an user error white deleting a record based on a
condition.
3. For that I am inheriting the model product.product:
4. The unlink function in the model product.product is overridden and raising an user error while
deleting a product variant having sales price above 500.
Thus we can override all functions like this.
5. Check our company website
for related blogs and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.