跳至内容
菜单
此问题已终结
1 回复
5526 查看

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
1040
1
11月 21
7166
3
8月 20
5665
1
6月 20
2445
3
12月 19
9419