From fa445f61175d659a58f7ce9b74cbfc5bb7d64525 Mon Sep 17 00:00:00 2001 From: "Louis Wicket (wil)" Date: Wed, 31 Aug 2022 11:24:59 +0000 Subject: [PATCH] [FIX] mail: make Activity/note field readonly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 3c28be1b33ea18be7280d9372ebd53a54140da86 enforced readonly by default on computed and related fields, but Activity/note was not adapted to be readonly, leading the application to crash when editing a note. This commit fixes it by introducing a new field to write on instead of the computed one. Follow-up of task-2955927. closes odoo/odoo#99310 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/models/activity.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/mail/static/src/models/activity.js b/addons/mail/static/src/models/activity.js index 7e3b0c7a7d7..ed7c64952b9 100644 --- a/addons/mail/static/src/models/activity.js +++ b/addons/mail/static/src/models/activity.js @@ -37,7 +37,7 @@ registerModel({ data2.id = data.id; } if ('note' in data) { - data2.note = data.note; + data2.rawNote = data.note; } if ('state' in data) { data2.state = data.state; @@ -246,10 +246,10 @@ registerModel({ * @returns {string|undefined} */ _computeNote() { - if (this.note === '


') { + if (this.rawNote === '


') { return clear(); } - return this.note; + return this.rawNote; }, /** * @private @@ -309,6 +309,7 @@ registerModel({ noteAsMarkup: attr({ compute: '_computeNoteAsMarkup', }), + rawNote: attr(), /** * Determines that an activity is linked to a requesting partner or not. * It will be used notably in website slides to know who triggered the