Show message on creating there is similar contact in odoo
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
Hi,
If you need to do this from code side, you can add a constrain and check for existing records and then raise a validation error if existing matches found.
You can achieve it by adding the below code in the corresponding model:
@api.constrains('email')
def _check_email_uniqueness(self):
for partner in self:
if partner.email:
existing_partner = self.env['res.partner'].search([
('email', '=', partner.email),
('id', '!=', partner.id)
])
if existing_partner:
raise UserError('Email already exists!')
If you need to achieve it from user interface, you can achieve it using, automated action.
See a similar example depicted here: Prevent Product Duplication without code using automated actions
Thanks
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
2
Aug 25
|
2327 | ||
|
1
Jul 25
|
849 | ||
|
1
Aug 25
|
1150 | ||
|
0
May 25
|
1313 | ||
|
2
Apr 25
|
3507 |