how can I check duplicate email when create new customers? Can anybody help me ? Thanks!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
Can I use sqlconstraints to check duplicate email like this?
_sql_constraints = [ ('email_unique', 'UNIQUE(email)', "The Email must be unique"), ]
Are you Vietnamese, Can you contact with me?
My email address: volamtruong01999@gmail.com
Yes, why don't you try it now XD
I was tried but it doesn't working for me
Try this
@api.constrains('email')
def _check_duplicate_email(self):
for rec in self:
emails = self.env['res.partner'].search([('email', '=', rec.email)])
for obj in emails:
if obj.email:
raise ValidationError("Duplicate Email")
Hi, there are many ways
- Use Data Cleaning Apps (Odoo14 EE): It will find all duplicate records for you
- Use search bar (if you know which email is duplicated)
- Create a custom groupby for email field and find all the emails which have more than 1 record
- Create automated action (Odoo EE): and write python code to check the email field
- overwrite the create function of model res.partner
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
1
ก.พ. 25
|
1255 | ||
|
0
เม.ย. 21
|
2221 | ||
|
4
พ.ค. 24
|
38489 | ||
|
1
มี.ค. 24
|
2651 | ||
Difference between Messages and Emails
แก้ไขแล้ว
|
|
2
ธ.ค. 20
|
6184 |