Odoo Help


Notifications in on_change method

on 7/2/13, 9:05 PM 2,380 views


I would like to implement a notification like "Globe" (as it appears when required fields are empty and placed [the Following fields are invalid:]) in a method on_change. Examining the code openERP only found a place where was implemented this type of message (addons / web / static / src / js / view_form.js: 867). I ask, you can use this notification type for a method on_change?.

On 7/3/13, 1:46 PM

Thank you very much for your answer Alex Malone. Upload a screenshot to my dropbox account to make it more clear what kind of notification I'm trying to implement,

dl.dropboxusercontent.com/u/ 49982149 /OpenERP/Globe_Message.PNG

Alex Malone
On 7/3/13, 7:35 AM

Not sure if this will answer your question or not as I don't know what globe notifications are, but in my system we use two types of notifications:

1) raise


raise osv.except_osv(_('Cannot Send E-mail'), _('No To address specified'))

This type of error message gets displayed as soon as the code is reached and will cause the system to roll back, i.e. any code run in your on_change function will be reversed / uncompleted if you use a raise notification. We use these for critical errors.

2) Warnings

This is probably what you want to use in your on_change method. In your on_change method you can return warning as part of the dictionary that gets returned. The warning message will be displayed to the user but will not interupt the running of any other code and wont roll back. The warning is returned in the following form:

return {'value': {}, 'warning': {'title': 'Warning Title Here', 'message': 'Your warning message here'}}

A good example of when we use this is when we are providing quotes. We have an on change method that works out the price based on quantity and unit price. Our on change method also checks for negative values and will warn the user about the negative value whilst also resetting the negative value.

Hope this helps.

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.


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

0 follower(s)


Asked: 7/2/13, 9:05 PM
Seen: 2380 times
Last updated: 3/16/15, 8:10 AM