Odoo Help

0

Alert with variable value

By
scot77844
on 1/15/16, 6:17 AM 764 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.

0
Yenthe
On 1/15/16, 7:04 AM

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

Thank you Yenthe. It worked.

scot77844
on 1/20/16, 4:38 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 1/15/16, 6:17 AM
Seen: 764 times
Last updated: 1/15/16, 9:21 AM