Use cancel_record instead of removing from group
cancel_record uses Screen.remove which ensure the cursor is correctly set after the removal. This also ensure that cancel_record remove only the current record. issue5852 review34331002
This commit is contained in:
1 parent
30147f38e5
commit
85d06d32cb
2 files changed
+5
-5
No files matched your search
@@ -575,7 +575,7 @@ class Screen(SignalEvent):
|
||||
if self.current_record:
|
||||
self.current_record.cancel()
|
||||
if self.current_record.id < 0:
|
||||
self.remove()
|
||||
self.remove(records=[self.current_record])
|
||||
|
||||
def save_current(self):
|
||||
if not self.current_record:
|
||||
@@ -657,8 +657,9 @@ class Screen(SignalEvent):
|
||||
for record in records:
|
||||
self.group.unremove(record)
|
||||
|
||||
def remove(self, delete=False, remove=False, force_remove=False):
|
||||
records = self.selected_records
|
||||
def remove(self, delete=False, remove=False, force_remove=False,
|
||||
records=None):
|
||||
records = records or self.selected_records
|
||||
if not records:
|
||||
return
|
||||
if delete:
|
||||
|
||||
@@ -411,8 +411,7 @@ class WinForm(NoModal, InfoBar):
|
||||
and response_id in cancel_responses):
|
||||
if (self.screen.current_record.id < 0
|
||||
or self.save_current):
|
||||
self.screen.group.remove(self.screen.current_record,
|
||||
remove=True)
|
||||
self.screen.cancel_current()
|
||||
elif self.screen.current_record.modified:
|
||||
self.screen.current_record.cancel()
|
||||
self.screen.current_record.reload()
|
||||
|
||||
Reference in new issue
Block a user