diff options
| author | Martin Trigaux <mat@openerp.com> | 2014-05-12 10:10:32 +0200 |
|---|---|---|
| committer | Martin Trigaux <mat@openerp.com> | 2014-05-12 10:10:32 +0200 |
| commit | 27a6d2e9f4ebf1449d4771219609d8483b2ba04e (patch) | |
| tree | f1e59fd12c706f1b32faecc85ab8282a8f09c6d9 /addons/web/static/src/js | |
| parent | dba3e92195631278395321957338792cb10f24af (diff) | |
| parent | 9e141c760c97af5a663ceacff4b7fdcfc5107acd (diff) | |
Forward-port of latest saas-4, up to revision 3994 (rev-id jke@openerp.com-20140509131203-4gy3nhlj0v6fk7zv)
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/chrome.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 2620e4ed40f..892f1af6ce8 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -46,6 +46,8 @@ instance.web.Notification = instance.web.Widget.extend({ } }); +var opened_modal = []; + instance.web.action_notify = function(element, action) { element.do_notify(action.params.title, action.params.text, action.params.sticky); }; @@ -113,6 +115,8 @@ instance.web.Dialog = instance.web.Widget.extend({ this.init_dialog(); } this.$buttons.insertAfter(this.$dialog_box.find(".modal-body")); + //add to list of currently opened modal + opened_modal.push(this.$dialog_box); return this; }, _add_buttons: function(buttons) { @@ -212,9 +216,13 @@ instance.web.Dialog = instance.web.Widget.extend({ //we need this to put the instruction to remove modal from DOM at the end //of the queue, otherwise it might already have been removed before the modal-backdrop //is removed when pressing escape key - var $parent = this.$el.parents('.modal'); setTimeout(function () { - $parent.remove(); + //remove last modal from list of opened modal since we just destroy it + opened_modal.pop().remove(); + if (opened_modal.length > 0){ + //we still have other opened modal so we should focus it + opened_modal[opened_modal.length-1].focus() + } },0); } this._super(); |
