I am trying to execute this python code to avoid repeating a task in my odoo and the error is not known
if record.name:
task = env ['project.task'].search([['name', '=', record.name]])
if task:
for e in task:
if e.id != record.id:
raise Warning ('La tarea esta creada')