[FIX] web: do not reload record on dialog close if the wizard return an action

bzr revid: dle@openerp.com-20140402165008-y19pnbb35eerrnwx
This commit is contained in:
Denis Ledoux 2014-04-02 18:50:08 +02:00
parent de117cd8ec
commit c0db6aec56
3 changed files with 12 additions and 12 deletions

View File

@ -105,9 +105,6 @@ instance.web.Dialog = instance.web.Widget.extend({
autoOpen: false, autoOpen: false,
position: [false, 40], position: [false, 40],
buttons: null, buttons: null,
beforeClose: function () {
self.trigger("closing");
},
resizeStop: function() { resizeStop: function() {
self.trigger("resized"); self.trigger("resized");
}, },
@ -208,8 +205,9 @@ instance.web.Dialog = instance.web.Widget.extend({
/** /**
Closes the popup, if destroy_on_close was passed to the constructor, it is also destroyed. Closes the popup, if destroy_on_close was passed to the constructor, it is also destroyed.
*/ */
close: function() { close: function(reason) {
if (this.dialog_inited && this.$el.is(":data(dialog)")) { if (this.dialog_inited && this.$el.is(":data(dialog)")) {
this.trigger("closing", reason);
this.$el.dialog('close'); this.$el.dialog('close');
} }
}, },
@ -225,14 +223,14 @@ instance.web.Dialog = instance.web.Widget.extend({
/** /**
Destroys the popup, also closes it. Destroys the popup, also closes it.
*/ */
destroy: function () { destroy: function (reason) {
this.$buttons.remove(); this.$buttons.remove();
_.each(this.getChildren(), function(el) { _.each(this.getChildren(), function(el) {
el.destroy(); el.destroy();
}); });
if (! this.__tmp_dialog_closing) { if (! this.__tmp_dialog_closing) {
this.__tmp_dialog_destroying = true; this.__tmp_dialog_destroying = true;
this.close(); this.close(reason);
this.__tmp_dialog_destroying = undefined; this.__tmp_dialog_destroying = undefined;
} }
if (this.dialog_inited && !this.isDestroyed() && this.$el.is(":data(dialog)")) { if (this.dialog_inited && !this.isDestroyed() && this.$el.is(":data(dialog)")) {

View File

@ -1982,8 +1982,10 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({
return this.view.do_execute_action( return this.view.do_execute_action(
_.extend({}, this.node.attrs, {context: context}), _.extend({}, this.node.attrs, {context: context}),
this.view.dataset, this.view.datarecord.id, function () { this.view.dataset, this.view.datarecord.id, function (reason) {
self.view.recursive_reload(); if (!_.isObject(reason)) {
self.view.recursive_reload();
}
}); });
}, },
check_disable: function() { check_disable: function() {

View File

@ -25,9 +25,9 @@ instance.web.ActionManager = instance.web.Widget.extend({
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.$el.on('click', 'a.oe_breadcrumb_item', this.on_breadcrumb_clicked); this.$el.on('click', 'a.oe_breadcrumb_item', this.on_breadcrumb_clicked);
}, },
dialog_stop: function () { dialog_stop: function (reason) {
if (this.dialog) { if (this.dialog) {
this.dialog.destroy(); this.dialog.destroy(reason);
} }
this.dialog = null; this.dialog = null;
}, },
@ -408,7 +408,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
if (this.dialog_widget && !this.dialog_widget.isDestroyed()) { if (this.dialog_widget && !this.dialog_widget.isDestroyed()) {
this.dialog_widget.destroy(); this.dialog_widget.destroy();
} }
this.dialog_stop(); this.dialog_stop(executor.action);
this.dialog = new instance.web.Dialog(this, { this.dialog = new instance.web.Dialog(this, {
dialogClass: executor.klass, dialogClass: executor.klass,
}); });
@ -426,7 +426,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
this.dialog.open(); this.dialog.open();
return initialized; return initialized;
} else { } else {
this.dialog_stop(); this.dialog_stop(executor.action);
this.inner_action = executor.action; this.inner_action = executor.action;
this.inner_widget = widget; this.inner_widget = widget;
executor.post_process(widget); executor.post_process(widget);