changeset a2a957b7407f in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=a2a957b7407f
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
diffstat:
tryton/gui/window/view_form/view/form.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (19 lines):
diff -r c3d403305e97 -r a2a957b7407f 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
@@ -468,12 +468,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)