Skip to Content
Menu
This question has been flagged
1 Atsakyti
2140 Rodiniai

How can I configure Odoo SaaS to not create a duplicate contact based on a criteria (such as email)?

Portretas
Atmesti
Best Answer

You can override create method like:

class Contacts(models.Model):
_inherit = 'res.partner'

@api.model
def create(self, vals_list):
email = vals_list.get('email', None)
if email:
partner = self.env['res.partner'].search([('email', '=', email)], limit=1)
if partner:
raise ValidationError('User already exists.')
return super(Contacts, self).create(vals_list)


Portretas
Atmesti
Autorius

Hello Arian,

Thank you for your response. I must mention that I am using Odoo SaaS. Do you have a solution for this version?

Related Posts Replies Rodiniai Veikla
0
bal. 22
2382
2
gruod. 24
1244
1
kov. 24
1377
2
rugp. 24
3620
2
liep. 25
2684