From f6e67650e8cb1f8f0be9e90dbaccf45692816c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Tue, 22 Sep 2020 16:25:24 +0000 Subject: [FIX] mail: ignore `undefined` in JS fields create/write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Passing a field containing `undefined` should lead to the same result as not passing the field. Fields that relied on `undefined` as a value have been changed to use the newly introduced `clear` command, that resets a field to its default value (often that is equal to `undefined`). task-2336491 closes odoo/odoo#58308 X-original-commit: b18824485483564d2ab80f41914a3548aa528ae0 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/models/thread_view/thread_view.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'addons/mail/static/src/models/thread_view/thread_view.js') diff --git a/addons/mail/static/src/models/thread_view/thread_view.js b/addons/mail/static/src/models/thread_view/thread_view.js index 599a99cc936..f2c64dabe2c 100644 --- a/addons/mail/static/src/models/thread_view/thread_view.js +++ b/addons/mail/static/src/models/thread_view/thread_view.js @@ -4,6 +4,7 @@ odoo.define('mail/static/src/models/thread_view/thread_view.js', function (requi const { registerNewModel } = require('mail/static/src/model/model_core.js'); const { RecordDeletedError } = require('mail/static/src/model/model_errors.js'); const { attr, many2many, many2one, one2one } = require('mail/static/src/model/model_field.js'); +const { clear } = require('mail/static/src/model/model_field_command.js'); function factory(dependencies) { @@ -77,9 +78,13 @@ function factory(dependencies) { */ _computeThreadCacheInitialScrollPosition() { if (!this.threadCache) { - return; + return clear(); + } + const threadCacheInitialScrollPosition = this.threadCacheInitialScrollPositions[this.threadCache.localId]; + if (threadCacheInitialScrollPosition !== undefined) { + return threadCacheInitialScrollPosition; } - return this.threadCacheInitialScrollPositions[this.threadCache.localId]; + return clear(); } /** @@ -102,7 +107,6 @@ function factory(dependencies) { } }); } - return true; } /** -- cgit v1.2.3