跳至內容
選單
此問題已被標幟
1 回覆
2087 瀏覽次數

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

頭像
捨棄
最佳答案

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)


頭像
捨棄
作者

Hello Arian,

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

相關帖文 回覆 瀏覽次數 活動
0
4月 22
2358
2
12月 24
1197
1
3月 24
1327
2
8月 24
3592
2
7月 25
2598