[FIX] web: onchange with domain should not crash if field is not in view

In some cases (onchange in a purchase order), the onchange can return a
domain for a field that is not in view.  It should not be the case, but
it is really simple to protect the web client anyway.
This commit is contained in:
Cedric Snauwaert
2017-07-05 14:47:13 +02:00
committed by Géry Debongnie
parent a43b0464b2
commit 1e30b30a8f
2 changed files with 4 additions and 1 deletions
@@ -2996,7 +2996,9 @@ var BasicModel = AbstractModel.extend({
if (result.domain) {
var fieldsInfo = record.fieldsInfo[viewType || record.viewType];
for (var fieldName in result.domain) {
fieldsInfo[fieldName].domain = result.domain[fieldName];
if (fieldsInfo[fieldName]) {
fieldsInfo[fieldName].domain = result.domain[fieldName];
}
}
}
return self._applyOnChange(result.value, record).then(function () {
@@ -1273,6 +1273,7 @@ QUnit.module('relational_fields', {
return $.when({
domain: {
trululu: domain,
unexisting_field: domain,
}
});
}