Position copied records based on order

issue9474
review311851002
This commit is contained in:
Cédric Krier committed 2020-07-25 00:49:32 +02:00
1 parent 85911599dc
commit fea3dd6067
3 files changed
+10 -5

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Position copied records based on order
* Allow configuration of default colors for graph and calendar
* Use existing context for get_preferences
* Add context to export URL
+6 -2
View File
@@ -237,7 +237,7 @@ class Group(SignalEvent, list):
return []
return list({}.fromkeys(res))
def load(self, ids, modified=False):
def load(self, ids, modified=False, position=-1):
if not ids:
return True
@@ -249,7 +249,11 @@ class Group(SignalEvent, list):
new_record = self.get(id)
if not new_record:
new_record = Record(self.model_name, id, group=self)
self.append(new_record)
if position == -1:
self.append(new_record)
else:
self.insert(position, new_record)
position += 1
new_record.signal_connect(self, 'record-changed',
self._record_changed)
new_record.signal_connect(self, 'record-modified',
+3 -3
View File
@@ -782,7 +782,7 @@ class Screen(SignalEvent):
context=self.context)
except RPCException:
return False
self.load(new_ids)
self.load(new_ids, position=self.new_position)
return True
def set_tree_state(self):
@@ -887,10 +887,10 @@ class Screen(SignalEvent):
domain, cls=JSONEncoder, separators=(',', ':'))
return json_domain
def load(self, ids, set_cursor=True, modified=False):
def load(self, ids, set_cursor=True, modified=False, position=-1):
self.tree_states.clear()
self.tree_states_done.clear()
self.group.load(ids, modified=modified)
self.group.load(ids, modified=modified, position=position)
self.current_view.reset()
if ids and self.current_view.view_type != 'calendar':
self.display(ids[0])