[FIX] mail: batch insert to speed up _setRelationInsertAndReplace

Part of task-2308312

X-original-commit: ceac1e5c3e200c0617ae6b62227079b47a7623d5
This commit is contained in:
Sébastien Theys
2020-08-03 15:49:03 +00:00
parent 470280b663
commit 505f0e9be9
+1 -10
View File
@@ -593,16 +593,7 @@ class ModelField {
// TODO IMP insert-and-replace should not unlink-all (task-2270780)
this._setRelationUnlink(record, null);
const OtherModel = this.env.models[this.to];
let other;
if (['one2one', 'many2one'].includes(this.relationType)) {
other = OtherModel.insert(data);
} else {
if (data instanceof Array) {
other = data.map(d => OtherModel.insert(d));
} else {
other = OtherModel.insert(data);
}
}
const other = OtherModel.insert(data);
this._setRelationLink(record, other);
}