changeset 0ff72f467a92 in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=0ff72f467a92
description:
        Do not rely on field views to load form fields

        If the views attribute of the field is wrong or empty, the record will 
not
        load the value for this field. The views attribute can be empty if it 
was
        created by copying the field from its parent.
        So it is safer to not rely on this attribute which is there only for
        optimization and instead always use all the fields defined on the view.

        issue8289
        review263471002
        (grafted from a2a957b7407f8d1b969842a20c6435818fee4afc)
diffstat:

 tryton/gui/window/view_form/view/form.py |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r 29dd58d69081 -r 0ff72f467a92 tryton/gui/window/view_form/view/form.py
--- a/tryton/gui/window/view_form/view/form.py  Sun May 05 19:32:24 2019 +0200
+++ b/tryton/gui/window/view_form/view/form.py  Sun May 05 19:33:48 2019 +0200
@@ -513,12 +513,13 @@
         if record:
             # Force to set fields in record
             # Get first the lazy one from the view to reduce number of requests
+            fields = ((name, record.group.fields[name])
+                for name in self.widgets)
             fields = (
                 (name,
                     field.attrs.get('loading', 'eager') == 'eager',
                     len(field.views))
-                for name, field in record.group.fields.items()
-                if self.view_id in field.views)
+                for name, field in fields)
             fields = sorted(fields, key=operator.itemgetter(1, 2))
             for field, _, _ in fields:
                 record[field].get(record)

Reply via email to