跳至内容
菜单
此问题已终结
2 回复
4474 查看

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
9月 18
6886
9
3月 16
60774
1
3月 15
4725
1
3月 15
5473
0
11月 24
7