Forward-port of latest saas-4, up to revision 3994 (rev-id jke@openerp.com-20140509131203-4gy3nhlj0v6fk7zv)
This commit is contained in:
commit
27a6d2e9f4
|
@ -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();
|
||||
|
|
|
@ -205,10 +205,10 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
|||
});
|
||||
var am = instance.webclient.action_manager;
|
||||
var form = am.dialog_widget.views.form.controller;
|
||||
form.on("on_button_cancel", am.dialog, am.dialog.close);
|
||||
form.on("on_button_cancel", am.dialog, function() { return am.dialog.$dialog_box.modal('hide'); });
|
||||
form.on('record_created', self, function(r) {
|
||||
(new instance.web.DataSet(self, self.group_by_field.relation)).name_get([r]).done(function(new_record) {
|
||||
am.dialog.close();
|
||||
am.dialog.$dialog_box.modal('hide');
|
||||
var domain = self.dataset.domain.slice(0);
|
||||
domain.push([self.group_by, '=', new_record[0][0]]);
|
||||
var dataset = new instance.web.DataSetSearch(self, self.dataset.model, self.dataset.get_context(), domain);
|
||||
|
|
Loading…
Reference in New Issue