changeset 093ffe5b68d7 in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset;node=093ffe5b68d7
description:
Keep record added/modified after cancel from popup window
We need to keep the record modified to ensure that it is added to the
xxx2Many
on save.
issue9298
review296601002
(grafted from f813fb56a83d7d7a5a116722d6783b706fd7e55e)
diffstat:
tryton/gui/window/win_form.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diffs (20 lines):
diff -r 7e98b9b3eeb4 -r 093ffe5b68d7 tryton/gui/window/win_form.py
--- a/tryton/gui/window/win_form.py Sat Oct 24 13:12:01 2020 +0200
+++ b/tryton/gui/window/win_form.py Sat Oct 24 13:14:55 2020 +0200
@@ -399,6 +399,7 @@
if (self.screen.current_record
and not readonly
and response_id in cancel_responses):
+ added = 'id' in self.screen.current_record.modified_fields
if (self.screen.current_record.id < 0
or self.save_current):
self.screen.cancel_current(self._initial_value)
@@ -406,6 +407,8 @@
self.screen.current_record.cancel()
self.screen.current_record.reload()
self.screen.current_record.signal('record-changed')
+ if added:
+ self.screen.current_record.modified_fields.setdefault('id')
result = False
else:
result = response_id not in cancel_responses