Correctly manage message after save and copy

issue4697
review23461002
This commit is contained in:
Cédric Krier committed 2015-09-25 18:05:08 +02:00
1 parent d35bfc788a
commit 60a5226464
1 file changed
+19 -12
+19 -12
View File
@@ -926,8 +926,9 @@
if ((this.current_view.view_type == 'tree') &&
(!jQuery.isEmptyObject(this.group))) {
this.set_current_record(this.group[0]);
} else {
return jQuery.when();
}
return jQuery.when();
}
this.current_view.set_value();
var fields = this.current_view.get_fields();
@@ -947,10 +948,13 @@
}
}.bind(this));
}
var display = function() {
return this.display();
}.bind(this);
return prm.then(display, display);
var dfd = jQuery.Deferred();
prm.then(function() {
this.display().always(dfd.resolve);
}.bind(this), function() {
this.display().always(dfd.reject);
}.bind(this));
return dfd.promise();
},
modified: function() {
var test = function(record) {
@@ -1022,14 +1026,17 @@
}.bind(this));
},
copy: function() {
var dfd = jQuery.Deferred();
var records = this.current_view.selected_records();
return this.model.copy(records, this.context).then(function(new_ids) {
this.group.load(new_ids);
if (!jQuery.isEmptyObject(new_ids)) {
this.set_current_record(this.group.get(new_ids[0]));
}
this.display();
}.bind(this));
this.model.copy(records, this.context).then(function(new_ids) {
this.group.load(new_ids).always(function() {
if (!jQuery.isEmptyObject(new_ids)) {
this.set_current_record(this.group.get(new_ids[0]));
}
this.display().always(dfd.resolve);
}.bind(this));
}.bind(this), dfd.reject);
return dfd.promise();
},
search_active: function(active) {
if (active && !this.group.parent) {