diff options
| author | Alexandre Kühn <aku@odoo.com> | 2018-07-16 11:03:47 +0200 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2018-07-16 14:08:40 +0200 |
| commit | 3210f108272be89f1a7b01f4e1816b7f04ae0a3b (patch) | |
| tree | 41ecf1123079212bf15149dd419f51dd628ed477 /addons/web/static/src/js/core/dialog.js | |
| parent | 0b7851604752b9c76028326ad3024b745857cd7b (diff) | |
[IMP] web: provide infos for close action
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/dialog.js')
| -rw-r--r-- | addons/web/static/src/js/core/dialog.js | 14 |
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 075c7359a55..847845ae17e 100644 --- a/addons/web/static/src/js/core/dialog.js +++ b/addons/web/static/src/js/core/dialog.js @@ -189,12 +189,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()) { |
