[FIX] web: _buildOnchangeSpecs must return only the present fields

Before: the method '_buildOnchangeSpecs' returned all fields, but some
models like 'res.users' have redefined the fields_get and add some fake
fields which cause a crash.
This commit is contained in:
Christophe Matthieu
2017-04-11 19:44:38 +02:00
committed by Aaron Bohy
parent 5e91027a86
commit ce36786038
3 changed files with 44 additions and 2 deletions
@@ -1239,8 +1239,8 @@ var BasicModel = AbstractModel.extend({
var field = record.fields[name];
specs[name] = (field.onChange) || "";
_.each(field.views, function (view) {
_.each(view.fields, function (field, subname) {
specs[name + '.' + subname] = (field.onChange) || "";
_.each(view.fieldAttrs, function (field, subname) {
specs[name + '.' + subname] = (view.fields[subname].onChange) || "";
});
});
});
@@ -89,6 +89,7 @@ var FormView = BasicView.extend({
field.views[viewName === 'list' ? 'tree' : viewName] = view;
field.relatedFields = fieldView.view_fields;
field.fieldAttrs = fieldView.fieldAttrs;
view.fieldAttrs = fieldView.fieldAttrs;
}
}));
}