[FIX] web: fix default values for x2many fields in mock_server

This commit is contained in:
David Monjoie
2017-04-11 19:44:38 +02:00
committed by Aaron Bohy
parent a0b31e7df5
commit acbbdd1a73
@@ -130,7 +130,13 @@ var MockServer = Class.extend({
continue;
}
if (!(fieldName in record)) {
record[fieldName] = model.fields[fieldName].default || false;
if ('default' in model.fields[fieldName]) {
record[fieldName] = model.fields[fieldName].default;
} else if (_.contains(['one2many', 'many2many'], model.fields[fieldName].type)) {
record[fieldName] = [];
} else {
record[fieldName] = false;
}
}
}
},