In my case, I need to allow the users to duplicate so, they can prevent typing the City, Province, Country, and Other extra information. But I have to restrict saving the same lead name twice.
I already used Automated Actions to prevent duplication but it's not letting to duplicate leads.
The code I used in Automated Action is:
existing_name = env['crm.lead'].search([('id', '!=', record.id), ('name', '=', record.name)])
if existing_name:
raise UserError(record.name + ' already exists!')
Is there are any ways to allow the duplication but while saving it has to show a different name or else the warning message has to pop up.
Thanks in advance.