summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2018-07-16 11:03:47 +0200
committerSimon Lejeune <sle@openerp.com>2018-08-13 14:23:19 +0200
commit65cc630050ed8e7642747a8f5b54d668f458dd0c (patch)
treed9dcbb2e067e145a4922330b03bbccb9664fb246 /addons/web/static/src/js/core
parent2502b34a7220ebf8c0a9f1b64861ab200f5bd9a8 (diff)
[IMP] web: provide infos for close action
This is a backport of 3210f108272be89f1a7b01f4e1816b7f04ae0a3b With this commit, when we perform a close action, we can provide infos to the `on_close` handler, so that it can handle different cases that caused the close action.
Diffstat (limited to 'addons/web/static/src/js/core')
-rw-r--r--addons/web/static/src/js/core/dialog.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/addons/web/static/src/js/core/dialog.js b/addons/web/static/src/js/core/dialog.js
index 7d4796886b7..2331cdaa12d 100644
--- a/addons/web/static/src/js/core/dialog.js
+++ b/addons/web/static/src/js/core/dialog.js
@@ -183,12 +183,22 @@ var Dialog = Widget.extend({
this.destroy();
},
- destroy: function (arg) {
+ /**
+ * Close and destroy the dialog.
+ *
+ * @param {Object} [options]
+ * @param {Object} [options.infos] if provided and `silent` is unset, the
+ * `on_close` handler will pass this information related to closing this
+ * information.
+ * @param {boolean} [options.silent=false] if set, do not call the
+ * `on_close` handler.
+ */
+ destroy: function (options) {
// Need to trigger before real destroy but if 'closed' handler destroys
// the widget again, we want to avoid infinite recursion
if (!this.__closed) {
this.__closed = true;
- this.trigger("closed", arg);
+ this.trigger('closed', options);
}
if (this.isDestroyed()) {