Skip to Content
Menú
This question has been flagged
1 Respondre
2099 Vistes

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

Avatar
Descartar
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)


Avatar
Descartar
Autor

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 Respostes Vistes Activitat
0
d’abr. 22
2361
2
de des. 24
1206
1
de març 24
1339
2
d’ag. 24
3598
2
de jul. 25
2601