summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/model/model.js
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2020-08-03 10:55:05 +0000
committerSébastien Theys <seb@odoo.com>2020-08-03 15:49:02 +0000
commit24fba9fed710bcde9b15b5712d672f61e192b053 (patch)
tree79f36ba43cd34fb4a287963c04e27a91f234ec71 /addons/mail/static/src/models/model/model.js
parent7f3a8d99287c835ee3ec703627c8ef906732c897 (diff)
[FIX] mail: speed up insert by using localId instead of find
Part of task-2308312 X-original-commit: 407dc9796543a27b6695c8d4da922c13dece5b38
Diffstat (limited to 'addons/mail/static/src/models/model/model.js')
-rw-r--r--addons/mail/static/src/models/model/model.js24
1 files changed, 7 insertions, 17 deletions
diff --git a/addons/mail/static/src/models/model/model.js b/addons/mail/static/src/models/model/model.js
index 6ee5125426d..6511cafa658 100644
--- a/addons/mail/static/src/models/model/model.js
+++ b/addons/mail/static/src/models/model/model.js
@@ -39,9 +39,9 @@ function factory() {
*/
init() {}
- //--------------------------------------------------------------------------
+ //----------------------------------------------------------------------
// Public
- //--------------------------------------------------------------------------
+ //----------------------------------------------------------------------
/**
* Returns all records of this model that match provided criteria.
@@ -154,20 +154,9 @@ function factory() {
this.env.modelManager.update(this, data);
}
- //--------------------------------------------------------------------------
+ //----------------------------------------------------------------------
// Private
- //--------------------------------------------------------------------------
-
- /**
- * @static
- * @private
- * @param {Object} data
- * @param {any} data.id
- * @return {function}
- */
- static _findFunctionFromData(data) {
- return record => record.id === data.id;
- }
+ //----------------------------------------------------------------------
/**
* This method generates a local id for this record that is
@@ -180,12 +169,13 @@ function factory() {
* track relations and records in the system instead of arbitrary
* number to differenciate them.
*
+ * @static
* @private
* @param {Object} data
* @returns {string}
*/
- _createRecordLocalId(data) {
- return _.uniqueId(`${this.constructor.modelName}_`);
+ static _createRecordLocalId(data) {
+ return _.uniqueId(`${this.modelName}_`);
}
/**