changeset 443c8f0f5f59 in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset;node=443c8f0f5f59
description:
        Skip destroyed records when fetching data from the server

        issue9669
        review294631002
        (grafted from 07a24f922b0c916392a6f7d28c579e74e5a94e0b)
diffstat:

 tryton/gui/window/view_form/model/group.py  |  1 +
 tryton/gui/window/view_form/model/record.py |  6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 3310e839c7e2 -r 443c8f0f5f59 tryton/gui/window/view_form/model/group.py
--- a/tryton/gui/window/view_form/model/group.py        Thu Oct 29 15:07:45 
2020 +0100
+++ b/tryton/gui/window/view_form/model/group.py        Fri Oct 30 19:01:11 
2020 +0100
@@ -187,6 +187,7 @@
         ctx['_timestamp'] = {}
         for rec in records:
             ctx['_timestamp'].update(rec.get_timestamp())
+            rec.destroy()
         record_ids = set(r.id for r in records)
         reload_ids = set(root_group.on_write_ids(list(record_ids)))
         reload_ids -= record_ids
diff -r 3310e839c7e2 -r 443c8f0f5f59 tryton/gui/window/view_form/model/record.py
--- a/tryton/gui/window/view_form/model/record.py       Thu Oct 29 15:07:45 
2020 +0100
+++ b/tryton/gui/window/view_form/model/record.py       Fri Oct 30 19:01:11 
2020 +0100
@@ -38,7 +38,7 @@
         self.destroyed = False
 
     def __getitem__(self, name):
-        if name not in self._loaded and self.id >= 0:
+        if not self.destroyed and self.id >= 0 and name not in self._loaded:
             id2record = {
                 self.id: self,
                 }
@@ -80,7 +80,9 @@
                 limit = int(CONFIG['client.limit'] / len(fnames))
 
                 def filter_group(record):
-                    return name not in record._loaded and record.id >= 0
+                    return (not record.destroyed
+                        and record.id >= 0
+                        and name not in record._loaded)
 
                 def filter_parent_group(record):
                     return (filter_group(record)

Reply via email to