تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
4459 أدوات العرض

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?

الصورة الرمزية
إهمال
أفضل إجابة

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.

الصورة الرمزية
إهمال
أفضل إجابة

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.

 

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
سبتمبر 18
6862
9
مارس 16
60764
1
مارس 15
4713
1
مارس 15
5467
0
نوفمبر 24
7