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.

1

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

By
peterson30
on 2/7/13, 6:45 PM 4,542 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"

1

Davide Corio

--Davide Corio--
1822
| 4 3 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(); } }); }); },

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

0 follower(s)

Stats

Asked: 2/7/13, 6:45 PM
Seen: 4542 times
Last updated: 3/16/15, 8:10 AM