在我的自定义模块中,我添加了
application_no = fields.Char(string="Application Number")
Run Code Online (Sandbox Code Playgroud)
_sql_constraints = [
('application_no_unique',
'UNIQUE(application_no)',
"Application Number already exist.Please specify another number or make sure the application number is correct"),
Run Code Online (Sandbox Code Playgroud)
]
我使用sql约束来显示警告.
它工作正常,当我们输入重复的应用程序编号时,它会显示警告并阻止保存记录的访问权限
题
警告发生时如何保存记录?
注意
我认为SQL约束不适合这个.是这个功能的任何其他方法?