From c457d0e401abf0dfb9b562a662f9dbd8f126fe50 Mon Sep 17 00:00:00 2001 From: Aman Patel Date: Mon, 26 Jun 2023 12:11:02 +0000 Subject: [PATCH] [FIX] sms: component getting destroyed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps: - Open field service - Go to Calendar view - Click on any data, so that the popover opens. - Click on the SMS button to send a message. Issue: - When we try to send the message, the traceback comes with the message 'Component is destroyed'. Cause: - When we try to send the message using 'Send SMS', before that the popover opened gets destroyed. The popover and wizard are different 2 components and hence we aren't able to control them. Fix: - We are performing load and notify methods only if the status of the component is not destroyed. task-3386925 closes odoo/odoo#144255 X-original-commit: 49b5054d0d530c3935cf053ae994dbebc12f1e04 Signed-off-by: Alexandre Kühn (aku) --- addons/sms/static/src/components/sms_button/sms_button.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/sms/static/src/components/sms_button/sms_button.js b/addons/sms/static/src/components/sms_button/sms_button.js index fd7407f84c5..305e4764bac 100644 --- a/addons/sms/static/src/components/sms_button/sms_button.js +++ b/addons/sms/static/src/components/sms_button/sms_button.js @@ -2,7 +2,7 @@ import { _t } from "@web/core/l10n/translation"; import { useService } from "@web/core/utils/hooks"; -import { Component } from "@odoo/owl"; +import { Component, status } from "@odoo/owl"; export class SendSMSButton extends Component { setup() { @@ -32,6 +32,9 @@ export class SendSMSButton extends Component { }, { onClose: () => { + if (status(this) === "destroyed") { + return; + } this.props.record.load(); }, }