Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
4582 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
sep. 18
7095
9
mrt. 16
60955
1
mrt. 15
4833
1
mrt. 15
5560
0
nov. 24
7