From dbdccd99c5a41bfdda068d1df016d91bdc175fe5 Mon Sep 17 00:00:00 2001 From: roen-odoo Date: Tue, 15 Feb 2022 10:03:57 +0000 Subject: [PATCH] [FIX] mail: Onchange error after done & schedule next activity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current behavior: In any chatter, if you schedule an activity then use the "Done & schedule next" options you had an error if you try to modify some fields of the record linked to the chatter. For example in CRM you couldn't modify the probability after using "Done & Schedule next" Steps to reproduce: -Go in CRM -Go on a lead page -In the chatter schedule an activity -Click on mark done and then on Done & Schedule next -Try to edit the probabilty field of the lead -You get an error : Record does not exist or has been deleted. (Record: mail.activity(x,), User: xx) opw-2648685 closes odoo/odoo#84841 X-original-commit: b45f024e96e17790427ad12e7f201567db0a249b Signed-off-by: Anh Thao PHAM Signed-off-by: Sébastien Theys (seb) Signed-off-by: Engels Robin (roen) --- .../activity_mark_done_popover_view.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/mail/static/src/models/activity_mark_done_popover_view/activity_mark_done_popover_view.js b/addons/mail/static/src/models/activity_mark_done_popover_view/activity_mark_done_popover_view.js index ab29081eafd..47ea5e973e4 100644 --- a/addons/mail/static/src/models/activity_mark_done_popover_view/activity_mark_done_popover_view.js +++ b/addons/mail/static/src/models/activity_mark_done_popover_view/activity_mark_done_popover_view.js @@ -26,21 +26,27 @@ registerModel({ * Handles click on this "Done" button. */ async onClickDone() { + const { chatter } = this.activityViewOwner.activityBoxView; await this.activityViewOwner.activity.markAsDone({ feedback: this.feedbackTextareaRef.el.value, }); - if (!this.exists() || !this.component) { + if (!chatter.exists() || !chatter.component) { return; } - this.component.trigger('reload', { keepChanges: true }); + chatter.reloadParentView(); }, /** * Handles click on this "Done & Schedule Next" button. */ - onClickDoneAndScheduleNext() { - this.activityViewOwner.activity.markAsDoneAndScheduleNext({ + async onClickDoneAndScheduleNext() { + const { chatter } = this.activityViewOwner.activityBoxView; + await this.activityViewOwner.activity.markAsDoneAndScheduleNext({ feedback: this.feedbackTextareaRef.el.value, }); + if (!chatter.exists() || !chatter.component) { + return; + } + chatter.reloadParentView(); }, /** * Handles keydown on this activity mark done.