From 8f2be0d61ba90bac34c47728f3cc4f1a5004c84b Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 23 Feb 2016 10:44:48 +0100 Subject: [PATCH] [IMP] web: update Dialog class Update Dialog class with enterprise version. --- addons/web/static/src/js/framework/dialog.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/framework/dialog.js b/addons/web/static/src/js/framework/dialog.js index b5e63834614..cbd3baa2a85 100644 --- a/addons/web/static/src/js/framework/dialog.js +++ b/addons/web/static/src/js/framework/dialog.js @@ -31,6 +31,7 @@ var Dialog = Widget.extend({ */ init: function (parent, options) { this._super(parent); + this._opened = $.Deferred(); options = _.defaults(options || {}, { title: _t('Odoo'), subtitle: '', @@ -96,7 +97,7 @@ var Dialog = Widget.extend({ set_title: function(title, subtitle) { this.title = title || ""; - if(subtitle !== undefined) { + if (subtitle !== undefined) { this.subtitle = subtitle || ""; } @@ -108,6 +109,10 @@ var Dialog = Widget.extend({ return this; }, + opened: function(handler) { + return (handler)? this._opened.then(handler) : this._opened; + }, + open: function() { $('.tooltip').remove(); // remove open tooltip if any to prevent them staying when modal is opened @@ -115,6 +120,7 @@ var Dialog = Widget.extend({ this.replace(this.$modal.find(".modal-body")).then(function() { self.$el.addClass('modal-body ' + self.dialogClass); self.$modal.modal('show'); + self._opened.resolve(); }); return self; @@ -125,8 +131,9 @@ var Dialog = Widget.extend({ }, destroy: function() { - if(this.isDestroyed()) + if (this.isDestroyed()) { return; + } this.trigger("closed");