Hi,
As you are looking to do it from the user interface activate the debug mode and make sure that the module named(technical name) base_automation is installed in database.
Navigate to Settings -> Technical -> Automation -> Automated Action, here you can create a new record for this purpose, in the below example it is shown for preventing the duplicates in the field Email in crm.lead Model,
Give a name for the record let it be Prevent Duplicates in Lead, select the model as Lead/Opportunity, set trigger condition and in the action to do choose execute python code.
Python Code to add:
leads = model.search([('email_from', '=', record.email_from)])
if leads:
raise Warning("Email Already Exists")
Click and save record, now when you create lead with duplicated email, it will raise warning like this,
Thanks
have a look at this app - https://apps.odoo.com/apps/modules/13.0/crm_duplicates/ - possible to define any stored fields as soft duplicates (just to warn) or rigid duplicate (to restrict creation)