Use cancel_record instead of removing from group

cancel_record uses Screen.remove which ensure the cursor is correctly set after
the removal.
This also ensure that cancel_record remove only the current record.

issue5852
review29641002
This commit is contained in:
Cédric Krier
2016-10-25 23:14:20 +02:00
parent d950a96805
commit 970c92abfc
2 changed files with 5 additions and 10 deletions
+4 -9
View File
@@ -1082,7 +1082,8 @@
if (this.current_record) {
this.current_record.cancel();
if (this.current_record.id < 0) {
prms.push(this.remove());
prms.push(this.remove(
false, false, false, [this.current_record]));
}
}
return jQuery.when.apply(jQuery, prms);
@@ -1163,14 +1164,8 @@
record.group.unremove(record);
});
},
remove: function(delete_, remove, force_remove) {
var records = null;
if ((this.current_view.view_type == 'form') &&
this.current_record) {
records = [this.current_record];
} else if (this.current_view.view_type == 'tree') {
records = this.current_view.selected_records();
}
remove: function(delete_, remove, force_remove, records) {
records = records | this.current_view.selected_records();
if (jQuery.isEmptyObject(records)) {
return;
}
+1 -1
View File
@@ -358,7 +358,7 @@
this.screen.current_record) {
result = false;
if ((this.screen.current_record.id < 0) || this.save_current) {
this.screen.group.remove(this.screen.current_record, true);
this.screen.cancel_current();
} else if (this.screen.current_record.has_changed()) {
this.screen.current_record.cancel();
this.screen.current_record.reload().always(function() {