From e2624c719cdec967d5784c4903ecc2492846b437 Mon Sep 17 00:00:00 2001 From: "Hubert Van de Walle (huvw)" Date: Thu, 9 Dec 2021 14:01:04 +0000 Subject: [PATCH] [FIX] mail: Refresh activities after calling mark as done from an editable form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to follow - Go to contacts - Schedule an activity - Click on edit next to the activity - Click on the Mark as done button -> The activity isn't refreshed Cause of the issue - The record is deleted when clicking on the mark as done button - The fetchAndUpdate is called after the form is closed - An exception is thrown -> the method exists early Solution Handle odoo.exceptions.MissingError and delete the record client side opw-2702492 closes odoo/odoo#81182 X-original-commit: c56ae82bffb933090a8df33bc38ab979d5318df7 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/models/activity/activity.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/models/activity/activity.js b/addons/mail/static/src/models/activity/activity.js index 654804e87a0..c961b786a26 100644 --- a/addons/mail/static/src/models/activity/activity.js +++ b/addons/mail/static/src/models/activity/activity.js @@ -135,11 +135,18 @@ registerModel({ }); }, async fetchAndUpdate() { - const [data] = await this.async(() => this.env.services.rpc({ + const [data] = await this.env.services.rpc({ model: 'mail.activity', method: 'activity_format', args: [this.id], - }, { shadow: true })); + }, { shadow: true }).catch(e => { + const errorName = e.message && e.message.data && e.message.data.name; + if (errorName === 'odoo.exceptions.MissingError') { + return []; + } else { + throw e; + } + }); let shouldDelete = false; if (data) { this.update(this.constructor.convertData(data));