From 505f0e9be9f7709c3146a39cb776c873eba09c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Mon, 3 Aug 2020 10:56:35 +0000 Subject: [PATCH] [FIX] mail: batch insert to speed up _setRelationInsertAndReplace Part of task-2308312 X-original-commit: ceac1e5c3e200c0617ae6b62227079b47a7623d5 --- addons/mail/static/src/model/model_field.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/addons/mail/static/src/model/model_field.js b/addons/mail/static/src/model/model_field.js index 1d31d42caf3..b318e35851e 100644 --- a/addons/mail/static/src/model/model_field.js +++ b/addons/mail/static/src/model/model_field.js @@ -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); }