changeset fb6a580b6735 in tryton:5.0 details: https://hg.tryton.org/tryton?cmd=changeset;node=fb6a580b6735 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 0110eb3f3ddde9e70c2e611c55bed79081e988cb) diffstat: tryton/gui/window/win_form.py | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diffs (27 lines): diff -r 843f49dfc8cc -r fb6a580b6735 tryton/gui/window/win_form.py --- a/tryton/gui/window/win_form.py Sat Oct 24 13:14:55 2020 +0200 +++ b/tryton/gui/window/win_form.py Wed Oct 28 00:02:52 2020 +0100 @@ -402,16 +402,17 @@ if (self.screen.current_record and not readonly and response_id in cancel_responses): - added = 'id' in self.screen.current_record.modified_fields + record = self.screen.current_record + added = 'id' in record.modified_fields if (self.screen.current_record.id < 0 or self.save_current): self.screen.cancel_current(self._initial_value) - elif self.screen.current_record.modified: - self.screen.current_record.cancel() - self.screen.current_record.reload() - self.screen.current_record.signal('record-changed') + elif record.modified: + record.cancel() + record.reload() + record.signal('record-changed') if added: - self.screen.current_record.modified_fields.setdefault('id') + record.modified_fields.setdefault('id') result = False else: result = response_id not in cancel_responses