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

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.

相關帖文 回覆 瀏覽次數 活動
0
12月 23
1033
1
11月 21
7159
3
8月 20
5663
1
6月 20
2441
3
12月 19
9409