How to Override Odoo Functions: Model’s Create/Update/Delete

There are 3 core methods that are related to a record. They are Create, Write, and Unlink. You can call them Create, Update, and Delete.

To override a model create/update/delete functions in Odoo, you can create a new module that extends the original model and adds the new functionality. 

Overriding these functions is simple. Here are the codes:

class CustomModel(models.Model):
    _name='custom.info'    

    name = fields.Char('name')

    @api.model
    def create(self, values):
        res = super(CustomModel,self).create(values)
        return res

    @api.multi
    def write(self, values):
        res = super(CustomModel, self).write(values)
        return res

    @api.multi
    def unlink(self, values):
        res = super(CustomModel, self).unlink()
        return res

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top