[FIX] mail: batch insert to speed up _setRelationInsertAndReplace
Part of task-2308312 X-original-commit: ceac1e5c3e200c0617ae6b62227079b47a7623d5
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user