Reviewers: ,


Please review this at http://codereview.tryton.org/671002/

Affected files:
  M tryton/gui/window/view_form/model/group.py


Index: tryton/gui/window/view_form/model/group.py
===================================================================
--- a/tryton/gui/window/view_form/model/group.py
+++ b/tryton/gui/window/view_form/model/group.py
@@ -25,6 +25,7 @@
         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 @@
         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 @@
         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 @@
         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


--
--
[email protected] mailing list

--- You received this message because you are subscribed to the Google Groups "tryton-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to