changeset 145f1a7253ca in sao:5.4
details: https://hg.tryton.org/sao?cmd=changeset;node=145f1a7253ca
description:
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
(grafted from c1ce7d0bb57f5cabb5f2b08ad43cd3d7b520f5b7)
diffstat:
src/window.js | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diffs (27 lines):
diff -r c7239649bb22 -r 145f1a7253ca src/window.js
--- a/src/window.js Sat Oct 24 13:14:55 2020 +0200
+++ b/src/window.js Wed Oct 28 00:02:52 2020 +0100
@@ -404,16 +404,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';