Odoo Help

Welcome!

This community 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.

0

Alert with variable value

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

--Yenthe--
6676
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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