[FIX] sms: component getting destroyed

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) <aku@odoo.com>
This commit is contained in:
Aman Patel
2023-11-30 18:38:04 +00:00
committed by Alexandre Kühn
parent 9519eec339
commit c457d0e401
@@ -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();
},
}