changeset c1ce7d0bb57f in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=c1ce7d0bb57f
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
diffstat:

 src/window.js |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (27 lines):

diff -r ce2c6704c95d -r c1ce7d0bb57f src/window.js
--- a/src/window.js     Mon Oct 26 21:24:19 2020 +0100
+++ b/src/window.js     Wed Oct 28 00:02:52 2020 +0100
@@ -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';

Reply via email to