İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
4606 Görünümler

How to show fields values in _constraints messages?

I want to show in the error messages the values of the fields that trigger the constraint, how to do this?

Avatar
Vazgeç
En İyi Yanıt

Hi,

Refer the code of base_vat module to show the value of field in constraint message:

"_construct_constraint_msg" method to show the message
_constraints = [(check_vat, _construct_constraint_msg, ["vat"])]

Hope this may help you.

Avatar
Vazgeç
En İyi Yanıt

Hi.

I think like the error messages: use string and edit it before shown

if not rout_id:
  e_mess = "No rotuing there " + str(row) + "  column"
  raise osv.except_osv(_('Error in imported data'), _(e_mess))   

The row is varaible of course in this case. U can use any field value as you want..

Bye.

 

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Eyl 18
7123
9
Mar 16
61011
1
Mar 15
4878
1
Mar 15
5591
0
Kas 24
7