跳至內容
選單
此問題已被標幟
3946 瀏覽次數

In my custom module I added the

application_no = fields.Char(string="Application Number") field.

_sql_constraints = [
 ('application_no_unique',
 'UNIQUE(application_no)',
 "Application Number already exist.Please specify another number or make sure the application number is correct"),

]

and I use sql constraint to shows warning.

It works correctly ,When we entered duplicate application number it will shows the warning and access of saving the record is prevented

Question


How to save the record while warning happens??

note


I think sql constraint is not suit for this. is any other method for this functionality?

頭像
捨棄

Hi, Have you tried returning a warning message in onchange for the field. It will allow you to save data

作者

Thanks amal: I will try that, That's the best solution

相關帖文 回覆 瀏覽次數 活動
0
5月 18
5852
2
11月 17
14608
1
9月 17
5638
2
7月 25
4533
2
12月 24
7699