Search on all children for ids to reload

issue2989
review671002
This commit is contained in:
Cédric Krier committed 2013-02-23 17:55:39 +01:00
1 parent f6e1e320a1
commit 5c28109ff7
1 file changed
+14 -2
+14 -2
View File
@@ -25,6 +25,7 @@ class Group(SignalEvent, list):
self.lock_signal = False
self.parent = parent
self.parent_name = parent_name or ''
self.children = []
self.child_name = child_name
self.parent_datetime_field = parent_datetime_field
self._context = context or {}
@@ -42,6 +43,9 @@ class Group(SignalEvent, list):
self.pool = WeakSet()
self.skip_model_access = False
if self.parent and self.parent.model_name == model_name:
self.parent.group.children.append(self)
@property
def readonly(self):
# Must skip res.user for Preference windows
@@ -188,8 +192,11 @@ class Group(SignalEvent, list):
return ids
def reload(self, ids):
for record in self:
if record.id in ids and not record.modified:
for child in self.children:
child.reload(ids)
for id_ in ids:
record = self.get(id_)
if record and not record.modified:
record._loaded.clear()
def on_write_ids(self, ids):
@@ -411,6 +418,11 @@ class Group(SignalEvent, list):
del self.__id2record[old_id]
def destroy(self):
if self.parent:
try:
self.parent.group.children.remove(self)
except ValueError:
pass
self.clear()
super(Group, self).destroy()
self.parent = None