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
This commit is contained in:
Cédric Krier committed 2019-05-05 19:33:48 +02:00
1 parent 3088e61855
commit 252b6fb378
1 file changed
+6 -8
+6 -8
View File
@@ -248,15 +248,13 @@ function eval_pyson(value){
// Force to set fields in record
// Get first the lazy one from the view to reduce number of requests
var fields = [];
for (name in record.model.fields) {
for (name in this.widgets) {
field = record.model.fields[name];
if (field.views.has(this.view_id)) {
fields.push([
name,
field.description.loading || 'eager' == 'eager',
field.views.size,
]);
}
fields.push([
name,
field.description.loading || 'eager' == 'eager',
field.views.size,
]);
}
fields.sort(function(a, b) {
if (!a[1] && b[1]) {