summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Galler <ngl@odoo.com>2020-10-29 09:45:40 +0000
committerNicolas Galler <ngl@odoo.com>2020-10-29 09:45:40 +0000
commit6d7058679869ba03e164993687c21b0bae12822d (patch)
treee85e283f37065b9214248f70b341846c29e045ee
parentb863b9cfedb3e7b4d1e3d409c829ffa0bfa1d9bb (diff)
[FIX] mail: don't refresh dirty record on message post
Behavior prior to this commit: When editing a lead, if we log a note, it will refresh the record and cause the changes to be lost. In version 13, it would only refresh the record if `@` mentions were added. Behavior after this commit: The record will only refresh if it is not dirty. Note: It is not clear why the record would in fact ever need to refresh as there is no visible change on the lead form when a note is logged, whether or not followers are added (the message thread, which shows the number of followers, refreshes regardless). In this commit I chose the approach which would cause the least change. There is still a need for a longer term solution to orchestrate the refreshes, which will take place once the rest of the web application is converted to use Owl. opw-2369162 closes odoo/odoo#60949 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
-rw-r--r--addons/mail/static/src/widgets/form_renderer/form_renderer.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/mail/static/src/widgets/form_renderer/form_renderer.js b/addons/mail/static/src/widgets/form_renderer/form_renderer.js
index 569e2fe8681..308d2a2a320 100644
--- a/addons/mail/static/src/widgets/form_renderer/form_renderer.js
+++ b/addons/mail/static/src/widgets/form_renderer/form_renderer.js
@@ -71,7 +71,11 @@ FormRenderer.include({
// while attempting to extend them.
this.on('o_chatter_rendered', this, ev => this._onChatterRendered(ev));
if (this.chatterFields.hasRecordReloadOnMessagePosted) {
- this.on('o_message_posted', this, ev => this.trigger_up('reload'));
+ this.on('o_message_posted', this, ev => {
+ if(!this.state.isDirty()) {
+ this.trigger_up('reload')
+ }
+ });
}
if (this.chatterFields.hasRecordReloadOnAttachmentsChanged) {
this.on('o_attachments_changed', this, ev => this.trigger_up('reload'));