summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorRomeo Fragomeli <rfr@odoo.com>2019-10-09 09:55:59 +0000
committerfw-bot <otis@odoo.com>2019-10-14 12:11:23 +0000
commit547d2d87fcf315314e3da0aad4771a3c4830b581 (patch)
tree8d65b31ca79523caf31cd3bd84785734f832732e /addons/web/static/src
parent3e5cc15d16e7f0dd38e2bfc3edd2b4a241e0d5ac (diff)
[FIX] web: not possible to show a notification via client action
Before this commit, it was not possible to show a message using a client action. (e.g. show a success message only with core in Python) Now, it's possible using a client action. This client action call displayNotification and so we can use the same options also. A test is added to be sure that this action do not change the current action Note: in the future a custom registry may be created in a refactoring to specific function action registry. X-original-commit: 8775fd670b6b3ec19a77fc0eab72d2223baa36c8
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/core/misc.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/addons/web/static/src/js/core/misc.js b/addons/web/static/src/js/core/misc.js
index 6260a4ab583..31f625ff0c5 100644
--- a/addons/web/static/src/js/core/misc.js
+++ b/addons/web/static/src/js/core/misc.js
@@ -177,6 +177,17 @@ function logout() {
core.action_registry.add("logout", logout);
/**
+ * @param {ActionManager} parent
+ * @param {Object} action
+ * @param {Object} action.params notification params
+ * @see ServiceMixin.displayNotification
+ */
+function displayNotification(parent, action) {
+ parent.displayNotification(action.params);
+}
+core.action_registry.add("display_notification", displayNotification);
+
+/**
* Client action to refresh the session context (making sure
* HTTP requests will have the right one) then reload the
* whole interface.