Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5582 มุมมอง

I'm trying to prevent users from creating duplicate customers, how can i do this for Odoo 8? 


Thank you. 



อวตาร
ละทิ้ง

Is it ok to add unique constraint on customer name + email ?

คำตอบที่ดีที่สุด

Here is the example.

# An old way
def copy(self, cr, uid, id, default=None, context=None):
raise osv.except_osv(_('Warning!'), _('You are not allowed to duplicate this!!!'))

And

# for new api
@api.one
def copy(self, default=None):
raise UserError(_('You are not allowed to duplicate this!!!'))

enjoy!

อวตาร
ละทิ้ง
ผู้เขียน

Thank you, Jusab.

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ธ.ค. 23
1085
1
พ.ย. 21
7302
3
ส.ค. 20
5780
1
มิ.ย. 20
2532
3
ธ.ค. 19
9509