From be01bbd97f734b4fb89934b3504fb7918eee8d3a Mon Sep 17 00:00:00 2001 From: Hiral Bhavsar Date: Fri, 9 Oct 2020 11:45:32 +0000 Subject: [PATCH] [FIX] mail: marking activity done from form view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit: When editing the activity, traceback while processing with buttons "Done & Schedule Next", "Mark as Done" from the form view. This is happening because when we process with these buttons it complete the action of respective buttons and then the trigger will go on the close window. Hence, we don't have activity data as "mark as done" remove the activity. After this commit: Footer buttons will be processed as expected without any traceback. Task-2357681 closes odoo/odoo#60174 X-original-commit: 623c5176a37ae5fd048d6bb10e742fac5caa6cf2 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/models/activity/activity.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/models/activity/activity.js b/addons/mail/static/src/models/activity/activity.js index b88c4b335d2..5b9af7013ca 100644 --- a/addons/mail/static/src/models/activity/activity.js +++ b/addons/mail/static/src/models/activity/activity.js @@ -160,8 +160,13 @@ function factory(dependencies) { method: 'activity_format', args: [this.id], }, { shadow: true })); - this.update(this.constructor.convertData(data)); - this.thread.refresh(); + if (data) { + this.update(this.constructor.convertData(data)); + this.thread.refresh(); + } else { + this.thread.refresh(); + this.delete(); + } } /**