Odoo Help


how to customize warrning message box or how to add my own message box e.g. in action after click my button?

on 2/7/13, 6:45 PM 5,931 views

I want to customize warning message box. E.g. I have one _constraints options on one column. I want to customize head and body of custom message. Of course I know that I can set message in _constraints but I want to control the whole message box.

And another subject. Can I add my own message box after user click on my button prepared in my own module? E.g. I want show message "Hi! Your data were saved successfully" after user click my button "proceed"


Davide Corio

--Davide Corio--

| 5 4 7
Bricherasio, Italy
--Davide Corio--

Odoo Evangelist and Consultant

Davide Corio
On 2/8/13, 6:57 PM

though it's a "dirty" solution, the most common way in OpenERP to pop up warning messages is to raise an exception, like:

raise osv.except_osv(_('Hi!'), _('Your data were saved successfully'))

Inside on_change methods, but only in this case afaik, you can "return" the warning message by doing:

return {'warning': {
                    'title': _('Hi!'),
                    'message':  _('Your data were saved successfully'),

I think there is another mechanism, like the one used when clicking "Reset Password" on a user, but I do not know how it works exactly.

Fabien Pinckaers (fp)
on 2/9/13, 4:51 AM

Hi Yes sure you can raise Alert Message when saving record through JS script it is possible you have to write single line code in path addons/web/static/src/js/viewform.js on_button_save: function() { var self = this; return this.save().done(function(result){ if (!confirm(_t("The record has been saved"))) { return false; } self.trigger("save", result); self.reload().then(function() { self.to_view_mode(); var parent = self.ViewManager.ActionManager.getParent(); if(parent){ parent.menu.do_reload_needaction(); } }); }); },

on 7/9/14, 7:30 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.


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: 2/7/13, 6:45 PM
Seen: 5931 times
Last updated: 3/16/15, 8:10 AM