Hello everyone,
I created a new module 'my_module', I created a view 'cours_view.xml' and a model 'cours.py', in the model, I overloaded the unlink and create function, but when I delete a course on the web interface the unlink function that I declared in the model is not called the same for create.
I spent the day on it, so please help me 🥸
below is the code of cours.py:
from odoo import models, fields, api
from odoo.exceptions import ValidationError
class MycustomemoduleCours(models.Model):
_name = 'mycustomemodule.cours'
_rec_name = 'title'
title = fields.Char()
description = fields.Text()
def unlink(self):
raise ValidationError("impossible")
print("*************************** test customize delete****************")
return super(MycustomemoduleCours, self).unlink()
@api.model
def create(self, vals):
print("***********create customize methodes")
return super(MycustomemoduleCours, self).create(vals)