v11 - Override BaseModel method
I need to change both "create" and "write" BaseModel methods so that, whenever a record is created/edited (any data model), some code of mine should run.
Here's what I've done so far:
_name = 'basemodel.extend'
@api.returns('self', lambda value: value.id)
def create(self, vals):
res = super(BaseModelExtend, self).create(vals)
_logger.info("THIS IS OK")
models.BaseModel.create = create
return super(BaseModelExtend, self)._register_hook()
I always get a TypeError: super(type, obj): obj must be an instance or subtype of type error!
Does anyone know the write syntax for this?