This question has been flagged
1 Reply
3299 Views

Hi guys,

I have written an on_change function in which I mentioned the following code for warning message.

warning = {

'title':_('Warning'),

'message':_('The parameter value must be an integer. But you have given the following value')

}


I need to display the value that is entered in the field name "field1", so that I can get the error message as "The parameter value must be an integer. But you have given the following value given_value"

How can I do it. Please help me with a solution.


Regards,

Scot.

Avatar
Discard
Best Answer

Hi Scot,

It depends a bit on if your API is written in V7 style or V8 style but in essence you can do this:

warning = {

'title':_('Warning'),

'message':_('The parameter value must be an integer. But you have given the following value \'' + str(self.field1) + '\'')

}

self is the reference to the current record in Odoo V8 API style. This could in V7 be another variable name and you could call it like dict['field'].
Yenthe

Avatar
Discard
Author

Thank you Yenthe. It worked.