diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-09-22 16:25:24 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-09-23 09:52:30 +0000 |
| commit | f6e67650e8cb1f8f0be9e90dbaccf45692816c3e (patch) | |
| tree | 1e08313ef69bfe827c321161e05ac44e27c8ca8b /addons/mail/static/src/models/thread_view/thread_view.js | |
| parent | bc00059bcd1c6475b00503e9242edd6547dbd93d (diff) | |
[FIX] mail: ignore `undefined` in JS fields create/write
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) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread_view/thread_view.js')
| -rw-r--r-- | addons/mail/static/src/models/thread_view/thread_view.js | 10 |
1 files changed, 7 insertions, 3 deletions
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; } /** |
