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

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

Overriding these functions are simple.

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 *