Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3972 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ

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

Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 18
5888
2
thg 11 17
14642
1
thg 9 17
5690
2
thg 7 25
4604
2
thg 12 24
7763