Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3950 มุมมอง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ค. 18
5858
How to raise warning on Odoo website? แก้ไขแล้ว
2
พ.ย. 17
14609
1
ก.ย. 17
5641
2
ก.ค. 25
4544
2
ธ.ค. 24
7706