Avoid display in switch_view when creating new record

The display in switch_view is useless as a second call is made after setting
the new record.

issue8539
review267711002
This commit is contained in:
Cédric Krier committed 2019-08-18 18:57:29 +02:00
1 parent 67285ecbc3
commit 79f1ce16fc
1 file changed
+17 -9
+17 -9
View File
@@ -878,7 +878,8 @@
get number_of_views() {
return this.views.length + this.view_to_load.length;
},
switch_view: function(view_type, view_id) {
switch_view: function(view_type, view_id, display) {
display = display === undefined ? true : display;
if ((view_id !== undefined) && (view_id !== null)) {
view_id = Number(view_id);
} else {
@@ -917,12 +918,19 @@
var _switch = function() {
var set_container = function() {
this.screen_container.set(this.current_view.el);
return this.display().done(function() {
this.set_cursor();
if (this.switch_callback) {
this.switch_callback();
}
}.bind(this));
var prm;
if (display) {
prm = this.display().done(function() {
this.set_cursor();
}.bind(this));
} else {
prm = jQuery.when();
}
return prm.done(function() {
if (this.switch_callback) {
this.switch_callback();
}
}.bind(this));
}.bind(this);
var continue_loop = function() {
if (!view_type && (view_id === null)) {
@@ -1348,13 +1356,13 @@
var prm = jQuery.when();
if (this.current_view.view_type == 'calendar') {
var selected_date = this.current_view.get_selected_date();
prm = this.switch_view('form');
prm = this.switch_view('form', undefined, false);
}
if (this.current_view &&
((this.current_view.view_type == 'tree' &&
!this.current_view.editable) ||
this.current_view.view_type == 'graph')) {
prm = this.switch_view('form');
prm = this.switch_view('form', undefined, false);
}
return prm.then(function() {
var group;