Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
3944 Ansichten

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?

Avatar
Verwerfen

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

Autor

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

Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Mai 18
5848
2
Nov. 17
14608
1
Sept. 17
5637
2
Juli 25
4531
2
Dez. 24
7699