From 8b9f0ac26409d25a118dfa200ac11900dc9b6ef3 Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Tue, 15 Nov 2022 14:48:05 +0000 Subject: [PATCH] [FIX] sms: save the record before opening the sms wizard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Issue:** - Open crm. - Open a lead. - Input a number in the phone field. - Click everywhere for the input to be recognized. - Click the sms button that appears when hovering over the phone field. - BUG1: The shown dialog doesn't have the inputted phone number. - BUG2: When closing the dialog, any changes made in the form before clicking the sms button are lost. **Solution:** Make sure the changes are saved before calling the action that shows the wizard. After this fix: - The phone number input in the form is now used in the wizard. - When closing the wizard, the "unsaved" changes are kept. closes odoo/odoo#105862 Task-id: 3056454 X-original-commit: a1bc67d811cab58e6ab336c636a1b1d83fc64446 Signed-off-by: Alexandre Kühn (aku) --- addons/sms/static/src/components/sms_button/sms_button.js | 3 ++- 1 file changed, 2 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 b99790dfea8..b1ecc30d17e 100644 --- a/addons/sms/static/src/components/sms_button/sms_button.js +++ b/addons/sms/static/src/components/sms_button/sms_button.js @@ -10,7 +10,8 @@ export class SendSMSButton extends Component { this.user = useService("user"); this.title = this.env._t("Send SMS Text Message"); } - onClick() { + async onClick() { + await this.props.record.save(); this.action.doAction({ type: "ir.actions.act_window", target: "new",