Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
13714 Переглядів

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"

Аватар
Відмінити
Найкраща відповідь

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.

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(); } }); }); },

Найкраща відповідь

https://apps.odoo.com/apps/modules/12.0/sh_message/

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
лип. 25
232
2
лип. 25
923
4
лип. 25
776
1
лип. 25
111
2
лип. 25
198