Do not rely on current record from screen

If the current record is removed, the attribute is set to None by
cancel_current.

issue9298
review314651002
This commit is contained in:
Cédric Krier committed 2020-10-28 00:02:52 +01:00
1 parent 4d4e779f1f
commit 59027c2698
1 file changed
+7 -6
+7 -6
View File
@@ -455,16 +455,17 @@
!readonly &&
this.screen.current_record) {
result = false;
var added = this.screen.current_record._changed.id;
if ((this.screen.current_record.id < 0) || this.save_current) {
var record = this.screen.current_record;
var added = record._changed.id;
if ((record.id < 0) || this.save_current) {
cancel_prm = this.screen.cancel_current(
this._initial_value);
} else if (this.screen.current_record.has_changed()) {
this.screen.current_record.cancel();
cancel_prm = this.screen.current_record.reload();
} else if (record.has_changed()) {
record.cancel();
cancel_prm = record.reload();
}
if (added) {
this.screen.current_record._changed.id = added;
record._changed.id = added;
}
} else {
result = response_id != 'RESPONSE_CANCEL';